Added fields and methods to java statement definition (#1117)

Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>
This commit is contained in:
Andreas Arvidsson 2022-11-08 15:46:42 +01:00 committed by GitHub
parent ac2a5411d9
commit ccf9d68166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 148 additions and 0 deletions

View File

@ -47,6 +47,9 @@ const STATEMENT_TYPES = [
// ";",
// "block",
"switch_statement",
"method_declaration",
"constructor_declaration",
"field_declaration",
];
const nodeMatchers: Partial<

View File

@ -0,0 +1,30 @@
languageId: java
command:
spokenForm: clear state
version: 3
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
action: {name: clearAndSetSelection}
initialState:
documentContents: |
public class MyClass {
@Inject
private Aaa aaa;
}
selections:
- anchor: {line: 2, character: 4}
active: {line: 2, character: 4}
marks: {}
finalState:
documentContents: |
public class MyClass {
}
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: statement}}]}]

View File

@ -0,0 +1,29 @@
languageId: java
command:
spokenForm: clear state
version: 3
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
action: {name: clearAndSetSelection}
initialState:
documentContents: |
public class MyClass {
private String value = "hello";
}
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
marks: {}
finalState:
documentContents: |
public class MyClass {
}
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: statement}}]}]

View File

@ -0,0 +1,30 @@
languageId: java
command:
spokenForm: clear state
version: 3
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
action: {name: clearAndSetSelection}
initialState:
documentContents: |
public class MyClass {
public MyClass() {
}
}
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
marks: {}
finalState:
documentContents: |
public class MyClass {
}
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: statement}}]}]

View File

@ -0,0 +1,30 @@
languageId: java
command:
spokenForm: clear state
version: 3
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
action: {name: clearAndSetSelection}
initialState:
documentContents: |
public class MyClass {
private void myFunction() {
}
}
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
marks: {}
finalState:
documentContents: |
public class MyClass {
}
selections:
- anchor: {line: 1, character: 4}
active: {line: 1, character: 4}
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: statement}}]}]

View File

@ -0,0 +1,26 @@
languageId: java
command:
spokenForm: clear state
version: 3
targets:
- type: primitive
modifiers:
- type: containingScope
scopeType: {type: statement}
usePrePhraseSnapshot: true
action: {name: clearAndSetSelection}
initialState:
documentContents: |
public class MyClass {
}
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
marks: {}
finalState:
documentContents: |+
selections:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: statement}}]}]