From bf89bd1a2b32b044e54a65b3b8b91cb0ce3fd1a4 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 9 Dec 2021 01:26:01 +0100 Subject: [PATCH 1/8] Include generic in java type definition --- src/languages/java.ts | 2 + .../languages/java/takeTypeBlueLook.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeGust.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeGust2.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeHarp.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeLook.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypePit.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeSoon.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeSoon2.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeTrap.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeTrap2.yml | 39 +++++++++++++++++++ .../recorded/languages/java/takeTypeYank.yml | 39 +++++++++++++++++++ 12 files changed, 431 insertions(+) create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeBlueLook.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeGust.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeGust2.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeHarp.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeLook.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypePit.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeSoon.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeSoon2.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeTrap.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeTrap2.yml create mode 100644 src/test/suite/fixtures/recorded/languages/java/takeTypeYank.yml diff --git a/src/languages/java.ts b/src/languages/java.ts index 20c93c678c..be406a45c8 100644 --- a/src/languages/java.ts +++ b/src/languages/java.ts @@ -60,6 +60,8 @@ const nodeMatchers: Partial> = { name: ["*[declarator][name]", "*[name]", "formal_parameter.identifier!"], namedFunction: ["method_declaration", "constructor_declaration"], type: trailingMatcher([ + "generic_type.type_arguments.type_identifier", + "generic_type.type_identifier", "type_identifier", "local_variable_declaration[type]", "array_creation_expression[type]", diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeBlueLook.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeBlueLook.yml new file mode 100644 index 0000000000..8295233de7 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeBlueLook.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type blue look + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: blue, character: l} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} + marks: + blue.l: + start: {line: 3, character: 8} + end: {line: 3, character: 12} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 8} + active: {line: 3, character: 20} + thatMark: + - anchor: {line: 3, character: 8} + active: {line: 3, character: 20} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: blue, character: l}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeGust.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeGust.yml new file mode 100644 index 0000000000..6decc8a30b --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeGust.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type gust + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: g} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 8} + active: {line: 3, character: 20} + marks: + default.g: + start: {line: 3, character: 13} + end: {line: 3, character: 19} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 8} + active: {line: 3, character: 20} + thatMark: + - anchor: {line: 3, character: 8} + active: {line: 3, character: 20} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: g}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeGust2.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeGust2.yml new file mode 100644 index 0000000000..e9b80be240 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeGust2.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type gust + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: g} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 32} + active: {line: 3, character: 49} + marks: + default.g: + start: {line: 3, character: 42} + end: {line: 3, character: 48} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 32} + active: {line: 3, character: 49} + thatMark: + - anchor: {line: 3, character: 32} + active: {line: 3, character: 49} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: g}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeHarp.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeHarp.yml new file mode 100644 index 0000000000..86a5902a55 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeHarp.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type harp + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: h} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} + marks: + default.h: + start: {line: 2, character: 38} + end: {line: 2, character: 45} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} + thatMark: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: h}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeLook.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeLook.yml new file mode 100644 index 0000000000..5d3ae49e42 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeLook.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type look + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: l} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 27} + active: {line: 2, character: 27} + marks: + default.l: + start: {line: 3, character: 21} + end: {line: 3, character: 25} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 8} + active: {line: 3, character: 20} + thatMark: + - anchor: {line: 3, character: 8} + active: {line: 3, character: 20} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: l}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypePit.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypePit.yml new file mode 100644 index 0000000000..bf55f6f07d --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypePit.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type pit + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: p} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 52} + active: {line: 3, character: 52} + marks: + default.p: + start: {line: 2, character: 8} + end: {line: 2, character: 11} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} + thatMark: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: p}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeSoon.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeSoon.yml new file mode 100644 index 0000000000..306f5b92a0 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeSoon.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type soon + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: s} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} + marks: + default.s: + start: {line: 2, character: 12} + end: {line: 2, character: 18} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} + thatMark: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: s}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeSoon2.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeSoon2.yml new file mode 100644 index 0000000000..d18040e375 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeSoon2.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type soon + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: s} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} + marks: + default.s: + start: {line: 2, character: 54} + end: {line: 2, character: 60} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} + thatMark: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: s}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeTrap.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeTrap.yml new file mode 100644 index 0000000000..07ff1ad9ae --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeTrap.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type trap + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: t} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} + marks: + default.t: + start: {line: 2, character: 20} + end: {line: 2, character: 26} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} + thatMark: + - anchor: {line: 2, character: 8} + active: {line: 2, character: 27} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: t}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeTrap2.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeTrap2.yml new file mode 100644 index 0000000000..1b5bb1f774 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeTrap2.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type trap + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: t} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} + marks: + default.t: + start: {line: 2, character: 46} + end: {line: 2, character: 52} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} + thatMark: + - anchor: {line: 2, character: 38} + active: {line: 2, character: 61} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: t}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/java/takeTypeYank.yml b/src/test/suite/fixtures/recorded/languages/java/takeTypeYank.yml new file mode 100644 index 0000000000..afd86d27d1 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/java/takeTypeYank.yml @@ -0,0 +1,39 @@ +languageId: java +command: + version: 1 + spokenForm: take type yank + action: setSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: 'y'} +initialState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 8} + active: {line: 3, character: 20} + marks: + default.y: + start: {line: 3, character: 32} + end: {line: 3, character: 41} +finalState: + documentContents: |- + public class MyClass { + private MyClass () { + Map map = new HashMap(); + List list = new ArrayList(); + } + } + selections: + - anchor: {line: 3, character: 32} + active: {line: 3, character: 49} + thatMark: + - anchor: {line: 3, character: 32} + active: {line: 3, character: 49} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: 'y'}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] From e824567a1434ef77d6c39c2ebe492cf1115740b9 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 9 Dec 2021 12:50:40 +0100 Subject: [PATCH 2/8] Make typescript type scope type consistent with java --- src/languages/typescript.ts | 53 ++++++++++++++++++++++++++++++++----- src/util/nodeSelectors.ts | 17 ++++++++++++ 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/src/languages/typescript.ts b/src/languages/typescript.ts index 102a9087ed..3abc002c30 100644 --- a/src/languages/typescript.ts +++ b/src/languages/typescript.ts @@ -9,14 +9,18 @@ import { conditionMatcher, } from "../util/nodeMatchers"; import { + NodeMatcher, NodeMatcherAlternative, + NodeMatcherValue, ScopeType, SelectionWithEditor, } from "../typings/Types"; import { getNodeInternalRange, getNodeRange, + pairSelectionExtractor, selectWithLeadingDelimiter, + simpleSelectionExtractor, } from "../util/nodeSelectors"; import { patternFinder } from "../util/nodeFinders"; @@ -69,12 +73,46 @@ const getTags = (selection: SelectionWithEditor, node: SyntaxNode) => { return startTag != null && endTag != null ? startTag.concat(endTag) : null; }; -const findTypeNode = (node: SyntaxNode) => { - const typeAnnotationNode = node.children.find((child) => - ["type_annotation", "opting_type_annotation"].includes(child.type) - ); - return typeAnnotationNode?.lastChild ?? null; -}; +function typeMatcher(): NodeMatcher { + const delimiterSelector = selectWithLeadingDelimiter(":"); + return function (selection: SelectionWithEditor, node: SyntaxNode) { + if (node.parent?.type === "new_expression" && node.type !== "new") { + const identifierNode = node.parent.children.find( + (n) => n.type === "identifier" + ); + const argsNode = node.parent.children.find( + (n) => n.type === "type_arguments" + ); + if (identifierNode && argsNode) { + return [ + { + node, + selection: pairSelectionExtractor( + selection.editor, + identifierNode, + argsNode + ), + }, + ]; + } + } + + const typeAnnotationNode = node.children.find((child) => + ["type_annotation", "opting_type_annotation"].includes(child.type) + ); + const targetNode = typeAnnotationNode?.lastChild; + + if (targetNode) { + return [ + { + node: targetNode, + selection: delimiterSelector(selection.editor, targetNode), + }, + ]; + } + return null; + }; +} function valueMatcher() { const pFinder = patternFinder("assignment_expression[right]", "*[value]"); @@ -160,7 +198,8 @@ const nodeMatchers: Partial> = { ], type: cascadingMatcher( // Typed parameters, properties, and functions - matcher(findTypeNode, selectWithLeadingDelimiter(":")), + typeMatcher(), + // matcher(findTypeNode, selectWithLeadingDelimiter(":")), // Type alias/interface declarations patternMatcher( "export_statement?.type_alias_declaration", diff --git a/src/util/nodeSelectors.ts b/src/util/nodeSelectors.ts index 9293c6782b..dc9dd3ecbd 100644 --- a/src/util/nodeSelectors.ts +++ b/src/util/nodeSelectors.ts @@ -54,6 +54,23 @@ export function simpleSelectionExtractor( }; } +export function pairSelectionExtractor( + editor: TextEditor, + node1: SyntaxNode, + node2: SyntaxNode +): SelectionWithContext { + const isForward = node1.startIndex < node2.startIndex; + const start = isForward ? node1 : node2; + const end = isForward ? node2 : node1; + return { + selection: new Selection( + new Position(start.startPosition.row, start.startPosition.column), + new Position(end.endPosition.row, end.endPosition.column) + ), + context: {}, + }; +} + export function argumentSelectionExtractor(): SelectionExtractor { return delimitedSelector( (node) => From 2e757e4e307c0b7097472a6a2309f5ada2512491 Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Thu, 9 Dec 2021 15:21:50 +0000 Subject: [PATCH 3/8] Add tests for typescript --- .../languages/typescript/clearType.yml | 23 ++++++++++++++++ .../languages/typescript/clearTypeAir.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeBat.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeLangle.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeNear.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeNear2.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeOx.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeOx2.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeUrge.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeWhale.yml | 27 +++++++++++++++++++ .../languages/typescript/clearTypeWrangle.yml | 27 +++++++++++++++++++ 11 files changed, 293 insertions(+) create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearType.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeAir.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeBat.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeLangle.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear2.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx2.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeUrge.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeWhale.yml create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearTypeWrangle.yml diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearType.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearType.yml new file mode 100644 index 0000000000..0cefa71ba8 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearType.yml @@ -0,0 +1,23 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} +initialState: + documentContents: "function whatever(): string {}" + selections: + - anchor: {line: 0, character: 18} + active: {line: 0, character: 18} + marks: {} +finalState: + documentContents: "function whatever(): {}" + selections: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} + thatMark: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} +fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeAir.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeAir.yml new file mode 100644 index 0000000000..e48743629f --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeAir.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type air + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: a, usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: string = new Bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.a: + start: {line: 0, character: 24} + end: {line: 0, character: 27} +finalState: + documentContents: "const foo: string = new (foo);" + selections: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} + thatMark: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: a, usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeBat.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeBat.yml new file mode 100644 index 0000000000..dbd7c96faf --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeBat.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type bat + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: b, usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: Bar = bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.b: + start: {line: 0, character: 25} + end: {line: 0, character: 28} +finalState: + documentContents: "const foo: = bar(foo);" + selections: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} + thatMark: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: b, usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeLangle.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeLangle.yml new file mode 100644 index 0000000000..609aab90ba --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeLangle.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type langle + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: <, usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: string = new Bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.<: + start: {line: 0, character: 27} + end: {line: 0, character: 28} +finalState: + documentContents: "const foo: string = new (foo);" + selections: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} + thatMark: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: <, usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear.yml new file mode 100644 index 0000000000..3d5652c54f --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type near + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: 'n', usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: string = new Bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.n: + start: {line: 0, character: 28} + end: {line: 0, character: 34} +finalState: + documentContents: "const foo: string = new (foo);" + selections: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} + thatMark: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: 'n', usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear2.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear2.yml new file mode 100644 index 0000000000..e147d9b0ec --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear2.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type near + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: 'n', usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: string = bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.n: + start: {line: 0, character: 24} + end: {line: 0, character: 30} +finalState: + documentContents: "const foo: = bar(foo);" + selections: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} + thatMark: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: 'n', usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx.yml new file mode 100644 index 0000000000..fc5f2c7f3a --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type ox + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: o, usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: string = new Bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.o: + start: {line: 0, character: 36} + end: {line: 0, character: 39} +finalState: + documentContents: "const foo: = new Bar(foo);" + selections: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} + thatMark: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: o, usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx2.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx2.yml new file mode 100644 index 0000000000..8022dd4fae --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx2.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type ox + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: o, usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: string = bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.o: + start: {line: 0, character: 32} + end: {line: 0, character: 35} +finalState: + documentContents: "const foo: = bar(foo);" + selections: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} + thatMark: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: o, usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeUrge.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeUrge.yml new file mode 100644 index 0000000000..fc46269b06 --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeUrge.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type urge + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: u, usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: Bar = new Bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.u: + start: {line: 0, character: 15} + end: {line: 0, character: 21} +finalState: + documentContents: "const foo: = new Bar(foo);" + selections: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} + thatMark: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: u, usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWhale.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWhale.yml new file mode 100644 index 0000000000..dfcaa610cd --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWhale.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type whale + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: w, usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: string = new Bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.w: + start: {line: 0, character: 20} + end: {line: 0, character: 23} +finalState: + documentContents: "const foo: = new Bar(foo);" + selections: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} + thatMark: + - anchor: {line: 0, character: 11} + active: {line: 0, character: 11} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: w, usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWrangle.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWrangle.yml new file mode 100644 index 0000000000..0148c1456e --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWrangle.yml @@ -0,0 +1,27 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type wrangle + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} + mark: {type: decoratedSymbol, symbolColor: default, character: '>', usePrePhraseSnapshot: true} +initialState: + documentContents: "const foo: string = new Bar(foo);" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: + default.>: + start: {line: 0, character: 34} + end: {line: 0, character: 35} +finalState: + documentContents: "const foo: string = new (foo);" + selections: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} + thatMark: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} +fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: '>', usePrePhraseSnapshot: true}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}] From f4cea626921725d05ba3af6e13ed2a1584057a31 Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Thu, 9 Dec 2021 15:22:31 +0000 Subject: [PATCH 4/8] Upgrade tests --- .../fixtures/recorded/languages/typescript/clearType.yml | 2 +- .../fixtures/recorded/languages/typescript/clearTypeAir.yml | 4 ++-- .../fixtures/recorded/languages/typescript/clearTypeBat.yml | 4 ++-- .../recorded/languages/typescript/clearTypeLangle.yml | 4 ++-- .../fixtures/recorded/languages/typescript/clearTypeNear.yml | 4 ++-- .../fixtures/recorded/languages/typescript/clearTypeNear2.yml | 4 ++-- .../fixtures/recorded/languages/typescript/clearTypeOx.yml | 4 ++-- .../fixtures/recorded/languages/typescript/clearTypeOx2.yml | 4 ++-- .../fixtures/recorded/languages/typescript/clearTypeUrge.yml | 4 ++-- .../fixtures/recorded/languages/typescript/clearTypeWhale.yml | 4 ++-- .../recorded/languages/typescript/clearTypeWrangle.yml | 4 ++-- .../recorded/surroundingPair/parseTree/json/clearPair.yml | 2 +- .../recorded/surroundingPair/parseTree/json/clearPair2.yml | 2 +- .../recorded/surroundingPair/parseTree/json/clearRound.yml | 2 +- .../recorded/surroundingPair/parseTree/json/clearRound2.yml | 2 +- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearType.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearType.yml index 0cefa71ba8..9df6f8aa17 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearType.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearType.yml @@ -1,6 +1,6 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type action: clearAndSetSelection targets: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeAir.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeAir.yml index e48743629f..9e6efee140 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeAir.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeAir.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type air action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: a, usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: a} initialState: documentContents: "const foo: string = new Bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeBat.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeBat.yml index dbd7c96faf..4ec7176f0e 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeBat.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeBat.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type bat action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: b, usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: b} initialState: documentContents: "const foo: Bar = bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeLangle.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeLangle.yml index 609aab90ba..af9f4c5529 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeLangle.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeLangle.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type langle action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: <, usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: <} initialState: documentContents: "const foo: string = new Bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear.yml index 3d5652c54f..95c88a3b30 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type near action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: 'n', usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: 'n'} initialState: documentContents: "const foo: string = new Bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear2.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear2.yml index e147d9b0ec..77cac47aba 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear2.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeNear2.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type near action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: 'n', usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: 'n'} initialState: documentContents: "const foo: string = bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx.yml index fc5f2c7f3a..44e7284074 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type ox action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: o, usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: o} initialState: documentContents: "const foo: string = new Bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx2.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx2.yml index 8022dd4fae..f3ed985e1f 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx2.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeOx2.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type ox action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: o, usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: o} initialState: documentContents: "const foo: string = bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeUrge.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeUrge.yml index fc46269b06..7e9cef82b1 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeUrge.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeUrge.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type urge action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: u, usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: u} initialState: documentContents: "const foo: Bar = new Bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWhale.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWhale.yml index dfcaa610cd..569a997857 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWhale.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWhale.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type whale action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: w, usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: w} initialState: documentContents: "const foo: string = new Bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWrangle.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWrangle.yml index 0148c1456e..e1efb6ab34 100644 --- a/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWrangle.yml +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearTypeWrangle.yml @@ -1,12 +1,12 @@ languageId: typescript command: - version: 0 + version: 1 spokenForm: clear type wrangle action: clearAndSetSelection targets: - type: primitive modifier: {type: containingScope, scopeType: type, includeSiblings: false} - mark: {type: decoratedSymbol, symbolColor: default, character: '>', usePrePhraseSnapshot: true} + mark: {type: decoratedSymbol, symbolColor: default, character: '>'} initialState: documentContents: "const foo: string = new Bar(foo);" selections: diff --git a/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearPair.yml b/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearPair.yml index fa01055470..72ce62b3d8 100644 --- a/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearPair.yml +++ b/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearPair.yml @@ -1,6 +1,6 @@ languageId: json command: - version: 0 + version: 1 spokenForm: clear pair action: clearAndSetSelection targets: diff --git a/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearPair2.yml b/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearPair2.yml index 17d44ab65c..23195956fc 100644 --- a/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearPair2.yml +++ b/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearPair2.yml @@ -1,6 +1,6 @@ languageId: json command: - version: 0 + version: 1 spokenForm: clear pair action: clearAndSetSelection targets: diff --git a/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearRound.yml b/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearRound.yml index f9393dd33a..1043f739d1 100644 --- a/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearRound.yml +++ b/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearRound.yml @@ -1,6 +1,6 @@ languageId: json command: - version: 0 + version: 1 spokenForm: clear round action: clearAndSetSelection targets: diff --git a/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearRound2.yml b/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearRound2.yml index c7d2e5540d..273c6ab9cf 100644 --- a/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearRound2.yml +++ b/src/test/suite/fixtures/recorded/surroundingPair/parseTree/json/clearRound2.yml @@ -1,6 +1,6 @@ languageId: json command: - version: 0 + version: 1 spokenForm: clear round action: clearAndSetSelection targets: From 3b6998ff8d03f616320fc15f99d0470137b75df2 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 9 Dec 2021 19:06:22 +0100 Subject: [PATCH 5/8] Added dock string --- src/util/nodeSelectors.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/nodeSelectors.ts b/src/util/nodeSelectors.ts index dc9dd3ecbd..5405d38c77 100644 --- a/src/util/nodeSelectors.ts +++ b/src/util/nodeSelectors.ts @@ -54,6 +54,10 @@ export function simpleSelectionExtractor( }; } +/** + * Extracts a selection from the first node to the second node. + * Both nodes are included in the selected nodes +*/ export function pairSelectionExtractor( editor: TextEditor, node1: SyntaxNode, From 9ffb7983c28033cd00ab55908baa8ec0632c4262 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 9 Dec 2021 19:14:41 +0100 Subject: [PATCH 6/8] Updated type for typescript constructor arguments --- src/languages/typescript.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/languages/typescript.ts b/src/languages/typescript.ts index 3abc002c30..bf969aeb71 100644 --- a/src/languages/typescript.ts +++ b/src/languages/typescript.ts @@ -76,7 +76,11 @@ const getTags = (selection: SelectionWithEditor, node: SyntaxNode) => { function typeMatcher(): NodeMatcher { const delimiterSelector = selectWithLeadingDelimiter(":"); return function (selection: SelectionWithEditor, node: SyntaxNode) { - if (node.parent?.type === "new_expression" && node.type !== "new") { + if ( + node.parent?.type === "new_expression" && + node.type !== "new" && + node.type !== "arguments" + ) { const identifierNode = node.parent.children.find( (n) => n.type === "identifier" ); From a9d66438c4b21b2529daadbaa19f128fb2e7dd9c Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Fri, 10 Dec 2021 09:53:08 +0100 Subject: [PATCH 7/8] Include constructor identifier without argument list in the definition of type --- src/languages/typescript.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/languages/typescript.ts b/src/languages/typescript.ts index bf969aeb71..529eebe522 100644 --- a/src/languages/typescript.ts +++ b/src/languages/typescript.ts @@ -98,6 +98,16 @@ function typeMatcher(): NodeMatcher { ), }, ]; + } else if (identifierNode) { + return [ + { + node: identifierNode, + selection: simpleSelectionExtractor( + selection.editor, + identifierNode + ), + }, + ]; } } From b449305281857534ba66fcbf808288a8eb523ea4 Mon Sep 17 00:00:00 2001 From: Pokey Rule Date: Fri, 10 Dec 2021 10:08:26 +0000 Subject: [PATCH 8/8] Add a test --- .../languages/typescript/clearType2.yml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/suite/fixtures/recorded/languages/typescript/clearType2.yml diff --git a/src/test/suite/fixtures/recorded/languages/typescript/clearType2.yml b/src/test/suite/fixtures/recorded/languages/typescript/clearType2.yml new file mode 100644 index 0000000000..649687023b --- /dev/null +++ b/src/test/suite/fixtures/recorded/languages/typescript/clearType2.yml @@ -0,0 +1,23 @@ +languageId: typescript +command: + version: 0 + spokenForm: clear type + action: clearAndSetSelection + targets: + - type: primitive + modifier: {type: containingScope, scopeType: type, includeSiblings: false} +initialState: + documentContents: "const foo: string = new Bar()" + selections: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} + marks: {} +finalState: + documentContents: "const foo: string = new ()" + selections: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} + thatMark: + - anchor: {line: 0, character: 24} + active: {line: 0, character: 24} +fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: type, includeSiblings: false}}]