mirror of
https://github.com/cursorless-dev/cursorless.git
synced 2024-10-05 05:17:38 +03:00
Fixed bug with array in pair value (#241)
This commit is contained in:
parent
7a107192d0
commit
0e67a27548
@ -63,7 +63,7 @@ const nodeMatchers: Partial<Record<ScopeType, NodeMatcherAlternative>> = {
|
||||
"*[name]",
|
||||
],
|
||||
collectionItem: argumentMatcher(...dictionaryTypes, ...listTypes),
|
||||
value: valueMatcher("assignment[right]", "*[value]"),
|
||||
value: valueMatcher("assignment[right]", "pair[value].*", "*[value]"),
|
||||
argumentOrParameter: argumentMatcher("parameters", "argument_list"),
|
||||
};
|
||||
|
||||
|
@ -40,12 +40,12 @@ export function selectWithLeadingDelimiter(
|
||||
editor: TextEditor,
|
||||
node: SyntaxNode
|
||||
): SelectionWithContext {
|
||||
const leadingDelimiterToken = node.previousSibling!;
|
||||
const leadingDelimiterToken = node.previousSibling;
|
||||
|
||||
const leadingDelimiterRange = makeRange(
|
||||
leadingDelimiterToken.startPosition,
|
||||
node.startPosition
|
||||
);
|
||||
const leadingDelimiterRange =
|
||||
leadingDelimiterToken != null
|
||||
? makeRange(leadingDelimiterToken.startPosition, node.startPosition)
|
||||
: null;
|
||||
|
||||
return {
|
||||
...simpleSelectionExtractor(editor, node),
|
||||
|
@ -0,0 +1,33 @@
|
||||
spokenForm: take value zero
|
||||
languageId: python
|
||||
command:
|
||||
actionName: setSelection
|
||||
partialTargets:
|
||||
- type: primitive
|
||||
modifier: {type: containingScope, scopeType: value, includeSiblings: false}
|
||||
mark: {type: decoratedSymbol, symbolColor: default, character: '0'}
|
||||
extraArgs: []
|
||||
marks:
|
||||
default.0:
|
||||
start: {line: 1, character: 15}
|
||||
end: {line: 1, character: 16}
|
||||
initialState:
|
||||
documentContents: |-
|
||||
{
|
||||
"foo": bar[0]
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 0}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
{
|
||||
"foo": bar[0]
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 11}
|
||||
active: {line: 1, character: 17}
|
||||
thatMark:
|
||||
- anchor: {line: 1, character: 11}
|
||||
active: {line: 1, character: 17}
|
||||
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '0'}, selectionType: token, position: contents, modifier: {type: containingScope, scopeType: value, includeSiblings: false}, insideOutsideType: inside}]
|
Loading…
Reference in New Issue
Block a user