-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Cursorless support for tree-sitter query .scm
files
#1448
Changes from all commits
495b695
307d47b
d512d65
2cbbf6a
b78c097
ab282e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,7 +130,7 @@ const testCases: TestCase[] = [ | |
}, | ||
|
||
{ | ||
name: "should show error for capture with multiple start", | ||
name: "should allow capture with multiple start", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This turned out to be useful for this PR; see https://github.com/cursorless-dev/cursorless/pull/1448/files#diff-83dc43cab688debd9b40743b835d49f7a047d393df9da5bb39e354f39aa09966R86-R87 |
||
captures: [ | ||
{ | ||
name: "@foo.start", | ||
|
@@ -145,8 +145,8 @@ const testCases: TestCase[] = [ | |
range: new Range(0, 2, 0, 3), | ||
}, | ||
], | ||
isValid: false, | ||
expectedErrorMessageIds: ["TreeSitterQuery.checkCaptures.duplicate"], | ||
isValid: true, | ||
expectedErrorMessageIds: [], | ||
}, | ||
|
||
{ | ||
|
@@ -157,7 +157,7 @@ const testCases: TestCase[] = [ | |
range: new Range(0, 0, 0, 0), | ||
}, | ||
{ | ||
name: "@foo.start", | ||
name: "@foo", | ||
range: new Range(0, 1, 0, 2), | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: bring name to air | ||
action: | ||
name: replaceWithTarget | ||
source: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: name} | ||
destination: | ||
type: primitive | ||
insertionMode: to | ||
target: | ||
type: primitive | ||
mark: {type: decoratedSymbol, symbolColor: default, character: a} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: |- | ||
(aaa) @bbb @ccc @ddd | ||
(eee) @fff | ||
selections: | ||
- anchor: {line: 1, character: 0} | ||
active: {line: 1, character: 0} | ||
marks: | ||
default.a: | ||
start: {line: 0, character: 1} | ||
end: {line: 0, character: 4} | ||
finalState: | ||
documentContents: |- | ||
(aaa) @fff | ||
(eee) @fff | ||
selections: | ||
- anchor: {line: 1, character: 0} | ||
active: {line: 1, character: 0} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: change every name | ||
action: | ||
name: clearAndSetSelection | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: everyScope | ||
scopeType: {type: name} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: (aaa) @bbb @ccc @ddd | ||
selections: | ||
- anchor: {line: 0, character: 0} | ||
active: {line: 0, character: 0} | ||
marks: {} | ||
finalState: | ||
documentContents: (aaa) @ @ @ | ||
selections: | ||
- anchor: {line: 0, character: 7} | ||
active: {line: 0, character: 7} | ||
- anchor: {line: 0, character: 9} | ||
active: {line: 0, character: 9} | ||
- anchor: {line: 0, character: 11} | ||
active: {line: 0, character: 11} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: change name | ||
action: | ||
name: clearAndSetSelection | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: name} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: (aaa) @bbb @ccc @ddd | ||
selections: | ||
- anchor: {line: 0, character: 0} | ||
active: {line: 0, character: 0} | ||
marks: {} | ||
finalState: | ||
documentContents: (aaa) @ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. notice how |
||
selections: | ||
- anchor: {line: 0, character: 7} | ||
active: {line: 0, character: 7} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: change name | ||
action: | ||
name: clearAndSetSelection | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: name} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: "eee: (aaa) @bbb @ccc @ddd" | ||
selections: | ||
- anchor: {line: 0, character: 0} | ||
active: {line: 0, character: 0} | ||
marks: {} | ||
finalState: | ||
documentContents: "eee: (aaa) @" | ||
selections: | ||
- anchor: {line: 0, character: 12} | ||
active: {line: 0, character: 12} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: change name | ||
action: | ||
name: clearAndSetSelection | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: name} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: "eee: _ @bbb @ccc @ddd" | ||
selections: | ||
- anchor: {line: 0, character: 0} | ||
active: {line: 0, character: 0} | ||
marks: {} | ||
finalState: | ||
documentContents: "eee: _ @" | ||
selections: | ||
- anchor: {line: 0, character: 8} | ||
active: {line: 0, character: 8} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: change value | ||
action: | ||
name: clearAndSetSelection | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: value} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: |- | ||
( | ||
aaa: (bbb) @ccc @ddd | ||
eee: "fff" @ggg | ||
hhh: (iii) | ||
jjj: [(kkk)] @lll | ||
mmm: ((nnn) (ooo))* @ppp | ||
qqq: _ @rrr | ||
) | ||
selections: | ||
- anchor: {line: 1, character: 4} | ||
active: {line: 1, character: 4} | ||
- anchor: {line: 2, character: 4} | ||
active: {line: 2, character: 4} | ||
- anchor: {line: 3, character: 4} | ||
active: {line: 3, character: 4} | ||
- anchor: {line: 4, character: 4} | ||
active: {line: 4, character: 4} | ||
- anchor: {line: 5, character: 4} | ||
active: {line: 5, character: 4} | ||
- anchor: {line: 6, character: 4} | ||
active: {line: 6, character: 4} | ||
marks: {} | ||
finalState: | ||
documentContents: |- | ||
( | ||
aaa: @ccc @ddd | ||
eee: @ggg | ||
hhh: | ||
jjj: @lll | ||
mmm: @ppp | ||
qqq: @rrr | ||
) | ||
selections: | ||
- anchor: {line: 1, character: 9} | ||
active: {line: 1, character: 9} | ||
- anchor: {line: 2, character: 9} | ||
active: {line: 2, character: 9} | ||
- anchor: {line: 3, character: 9} | ||
active: {line: 3, character: 9} | ||
- anchor: {line: 4, character: 9} | ||
active: {line: 4, character: 9} | ||
- anchor: {line: 5, character: 9} | ||
active: {line: 5, character: 9} | ||
- anchor: {line: 6, character: 9} | ||
active: {line: 6, character: 9} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: chuck key | ||
action: | ||
name: remove | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: collectionKey} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: |- | ||
( | ||
aaa: (bbb) @ccc | ||
) | ||
selections: | ||
- anchor: {line: 1, character: 19} | ||
active: {line: 1, character: 19} | ||
marks: {} | ||
finalState: | ||
documentContents: |- | ||
( | ||
(bbb) @ccc | ||
) | ||
selections: | ||
- anchor: {line: 1, character: 14} | ||
active: {line: 1, character: 14} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: chuck name | ||
action: | ||
name: remove | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: name} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: (aaa) @bbb @ccc @ddd | ||
selections: | ||
- anchor: {line: 0, character: 0} | ||
active: {line: 0, character: 0} | ||
marks: {} | ||
finalState: | ||
documentContents: "(aaa) " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't love this space, but I think it should probably be handled by #855 |
||
selections: | ||
- anchor: {line: 0, character: 0} | ||
active: {line: 0, character: 0} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
languageId: scm | ||
command: | ||
version: 6 | ||
spokenForm: chuck name | ||
action: | ||
name: remove | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: name} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: (aaa) @bbb @ccc @ddd | ||
selections: | ||
- anchor: {line: 0, character: 20} | ||
active: {line: 0, character: 20} | ||
marks: {} | ||
finalState: | ||
documentContents: "(aaa) @bbb @ccc " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as above re space |
||
selections: | ||
- anchor: {line: 0, character: 16} | ||
active: {line: 0, character: 16} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning or more towards just including our own missing file extensions instead of having to add additional extension dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Tho wrt .scm specifically, @auscompgeek makes a good point that we may want to avoid that one as it is more commonly used for Scheme. But for .talon and the others I think it makes sense for us to just register them