-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Snippet wrap #296
Snippet wrap #296
Changes from 18 commits
8dd40cf
61fc7bc
357719e
180f374
cfa46fc
df99a07
a52473f
2a84b42
f411204
b9e1ac1
90d5a5b
8b86f10
7ccafc2
1df155c
6388499
b1a53e2
2e9f7b1
58c5b83
d741029
30b8163
36035c6
5722322
3da4762
541fd3f
07fdfcf
7205c61
1810d62
45e4f82
a0a190d
20a2717
f74bd50
bac3d38
7d716be
a8926a5
6adc0af
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 |
---|---|---|
|
@@ -400,6 +400,138 @@ | |
"verticalOffset": 0 | ||
} | ||
} | ||
}, | ||
"cursorless.experimental.snippets": { | ||
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. Tagged the setting as experimental |
||
"description": "Snippets for use in cursorless", | ||
"type": "object", | ||
"default": { | ||
"ifStatement": { | ||
"definitions": [], | ||
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. We put the definitions elsewhere so that the user can easily put their own, which take precedence over built-in ones |
||
"defaultScopeTypes": { | ||
"consequence": "statement" | ||
}, | ||
"description": "If statement" | ||
}, | ||
"tryCatchStatement": { | ||
"definitions": [], | ||
"defaultScopeTypes": { | ||
"body": "statement", | ||
"exceptBody": "statement" | ||
}, | ||
"description": "Try catch statement" | ||
}, | ||
"ifElseStatement": { | ||
"definitions": [], | ||
"defaultScopeTypes": { | ||
"consequence": "statement", | ||
"alternative": "statement" | ||
}, | ||
"description": "If else statement" | ||
} | ||
}, | ||
"additionalProperties": { | ||
"type": "object", | ||
"properties": { | ||
"definitions": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"scope": { | ||
"type": "object", | ||
"desription": "Scopes where this snippet is active", | ||
"properties": { | ||
"langIds": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"scopeType": { | ||
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 |
||
"type": "string", | ||
"enum": [ | ||
"argumentOrParameter", | ||
"anonymousFunction", | ||
"attribute", | ||
"class", | ||
"className", | ||
"collectionItem", | ||
"collectionKey", | ||
"comment", | ||
"functionCall", | ||
"functionName", | ||
"ifStatement", | ||
"list", | ||
"map", | ||
"name", | ||
"namedFunction", | ||
"regularExpression", | ||
"statement", | ||
"string", | ||
"type", | ||
"value", | ||
"xmlBothTags", | ||
"xmlElement", | ||
"xmlEndTag", | ||
"xmlStartTag" | ||
] | ||
} | ||
} | ||
}, | ||
"body": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "Inline snippet text; entries joined by newline" | ||
} | ||
}, | ||
"required": [ | ||
"body" | ||
] | ||
} | ||
}, | ||
"defaultScopeTypes": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string", | ||
"enum": [ | ||
"argumentOrParameter", | ||
"anonymousFunction", | ||
"attribute", | ||
"class", | ||
"className", | ||
"collectionItem", | ||
"collectionKey", | ||
"comment", | ||
"functionCall", | ||
"functionName", | ||
"ifStatement", | ||
"list", | ||
"map", | ||
"name", | ||
"namedFunction", | ||
"regularExpression", | ||
"statement", | ||
"string", | ||
"type", | ||
"value", | ||
"xmlBothTags", | ||
"xmlElement", | ||
"xmlEndTag", | ||
"xmlStartTag" | ||
] | ||
} | ||
}, | ||
"description": { | ||
"type": "string", | ||
"description": "Description of the snippet" | ||
} | ||
}, | ||
"required": [ | ||
"definitions" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -432,7 +564,7 @@ | |
"js-yaml": "^4.1.0", | ||
"mocha": "^8.1.3", | ||
"sinon": "^11.1.1", | ||
"typescript": "^4.1.2", | ||
"typescript": "^4.4.4", | ||
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. Note the typescript version bump |
||
"vscode-test": "^1.4.1" | ||
}, | ||
"dependencies": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ interface MarkEntry { | |
} | ||
|
||
class BringMoveSwap implements Action { | ||
targetPreferences: ActionPreferences[] = [ | ||
getTargetPreferences: () => ActionPreferences[] = () => [ | ||
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. We now have a function to give action a chance to see args |
||
{ insideOutsideType: null }, | ||
{ insideOutsideType: null }, | ||
]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import { | |
} from "../typings/Types"; | ||
|
||
export class Sort implements Action { | ||
targetPreferences: ActionPreferences[] = [{ insideOutsideType: "inside" }]; | ||
getTargetPreferences: () => ActionPreferences[] = () => [{ insideOutsideType: "inside" }]; | ||
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.
|
||
|
||
constructor(private graph: Graph) { | ||
this.run = this.run.bind(this); | ||
|
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.
Easy way to update snapshots