Fixed bug with array in pair value (#241)

This commit is contained in:
Andreas Arvidsson 2021-08-16 15:27:07 +02:00 committed by GitHub
parent 7a107192d0
commit 0e67a27548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 6 deletions

View File

@ -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"),
};

View File

@ -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),

View File

@ -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}]