Skip to content

Commit

Permalink
Disqualify arrow delimiter in function type (#2731)
Browse files Browse the repository at this point in the history
Disqualified `=>` in typescript function type definitions to be used in
a matching pair delimiter.

## Checklist

- [x] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [/] I have not broken the cheatsheet
  • Loading branch information
AndreasArvidsson authored Jan 17, 2025
1 parent ef4a11e commit 6db1575
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
22 changes: 22 additions & 0 deletions data/fixtures/recorded/languages/typescript/changeInside.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
languageId: typescript
command:
version: 7
spokenForm: change inside
action:
name: clearAndSetSelection
target:
type: primitive
modifiers:
- {type: interiorOnly}
usePrePhraseSnapshot: false
initialState:
documentContents: Promise<() => number>;
selections:
- anchor: {line: 0, character: 14}
active: {line: 0, character: 14}
marks: {}
finalState:
documentContents: Promise<>;
selections:
- anchor: {line: 0, character: 8}
active: {line: 0, character: 8}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Promise<() => number>
---
[Content] = 0:11-0:13
>--<
0| Promise<() => number>
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ export const scopeSupportFacets = [
// FIXME: Still in legacy
// selector
// unit
// collectionItem
] as const;

export interface ScopeSupportFacetInfo {
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/scopeSupportFacets/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ export const typescriptScopeSupport: LanguageScopeSupportFacetMap = {

"value.field": supported,
"value.typeAlias": supported,

disqualifyDelimiter: supported,
};
5 changes: 5 additions & 0 deletions queries/typescript.core.scm
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,8 @@
.
";"? @statement.end
)

;; () => number
(function_type
"=>" @disqualifyDelimiter
)

0 comments on commit 6db1575

Please sign in to comment.