Skip to content

Commit 698559e

Browse files
Added python import to collection item (#2090)
Fixes #1876 ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
1 parent ea039d3 commit 698559e

File tree

2 files changed

+27
-0
lines changed
  • packages
    • cursorless-engine/src/languages
    • cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python

2 files changed

+27
-0
lines changed

packages/cursorless-engine/src/languages/python.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ const nodeMatchers: Partial<
4343
itemNodeFinder("import_from_statement", "dotted_name", true),
4444
argumentSelectionExtractor(),
4545
),
46+
matcher(
47+
itemNodeFinder("import_statement", "dotted_name", false),
48+
argumentSelectionExtractor(),
49+
),
4650
matcher(
4751
itemNodeFinder("global_statement", "identifier"),
4852
argumentSelectionExtractor(),
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
languageId: python
2+
command:
3+
version: 6
4+
spokenForm: chuck item
5+
action:
6+
name: remove
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: collectionItem}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: import foo, baz
15+
selections:
16+
- anchor: {line: 0, character: 7}
17+
active: {line: 0, character: 7}
18+
marks: {}
19+
finalState:
20+
documentContents: import baz
21+
selections:
22+
- anchor: {line: 0, character: 7}
23+
active: {line: 0, character: 7}

0 commit comments

Comments
 (0)