Skip to content

Commit

Permalink
Merge branch 'main' into pokey/implement-more-typescript-scope-types-…
Browse files Browse the repository at this point in the history
…using-queries
  • Loading branch information
pokey authored Jun 15, 2023
2 parents d9f004b + fcdf70c commit fed023b
Show file tree
Hide file tree
Showing 99 changed files with 449 additions and 394 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ repos:
entry: Forbid symlinks
language: fail
types: [symlink]
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.1
hooks:
- id: forbid-crlf
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand Down
123 changes: 0 additions & 123 deletions cursorless-talon/.vscode/.ropeproject/config.py

This file was deleted.

Binary file removed cursorless-talon/.vscode/.ropeproject/objectdb
Binary file not shown.
5 changes: 5 additions & 0 deletions cursorless-talon/src/cheatsheet/sections/modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get_modifiers():
"previous",
"next",
"backward",
"forward",
]
simple_modifiers = {
key: value
Expand Down Expand Up @@ -125,6 +126,10 @@ def get_modifiers():
"spokenForm": f"<scope> {complex_modifiers['backward']}",
"description": "single instance of <scope> including target, going backwards",
},
{
"spokenForm": f"<scope> {complex_modifiers['forward']}",
"description": "single instance of <scope> including target, going forwards",
},
{
"spokenForm": f"<number> <scope>s {complex_modifiers['backward']}",
"description": "<number> instances of <scope> including target, going backwards",
Expand Down
6 changes: 3 additions & 3 deletions data/playground/xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<root>
<name id="some id">Some text</name>
</root>
<root>
<name id="some id">Some text</name>
</root>
58 changes: 58 additions & 0 deletions packages/cheatsheet/src/lib/sampleSpokenFormInfos/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,16 @@
}
]
},
{
"id": "inferPreviousMark",
"type": "modifier",
"variations": [
{
"spokenForm": "its",
"description": "Infer previous mark"
}
]
},
{
"id": "interiorOnly",
"type": "modifier",
Expand Down Expand Up @@ -794,6 +804,14 @@
"spokenForm": "previous <number> <scope>s",
"description": "previous <number> instances of <scope>"
},
{
"spokenForm": "<scope> backward",
"description": "single instance of <scope> including target, going backwards"
},
{
"spokenForm": "<scope> forward",
"description": "single instance of <scope> including target, going forwards"
},
{
"spokenForm": "<number> <scope>s backward",
"description": "<number> instances of <scope> including target, going backwards"
Expand Down Expand Up @@ -1056,6 +1074,16 @@
}
]
},
{
"id": "branch",
"type": "scopeType",
"variations": [
{
"spokenForm": "branch",
"description": "Branch"
}
]
},
{
"id": "chapter",
"type": "scopeType",
Expand Down Expand Up @@ -1186,6 +1214,16 @@
}
]
},
{
"id": "identifier",
"type": "scopeType",
"variations": [
{
"spokenForm": "identifier",
"description": "Identifier"
}
]
},
{
"id": "ifStatement",
"type": "scopeType",
Expand All @@ -1196,6 +1234,16 @@
}
]
},
{
"id": "instance",
"type": "scopeType",
"variations": [
{
"spokenForm": "instance",
"description": "Instance"
}
]
},
{
"id": "line",
"type": "scopeType",
Expand Down Expand Up @@ -1386,6 +1434,16 @@
}
]
},
{
"id": "unit",
"type": "scopeType",
"variations": [
{
"spokenForm": "unit",
"description": "Unit"
}
]
},
{
"id": "url",
"type": "scopeType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { SelectionWithEditor } from "../../typings/Types";

/**
* Given a selection with an editor, constructs an appropriate `Target` to use
* for a `that` mark. It uses an `UntypedTarget`, and if the selection is
* empty, it sets `hasExplicitRange` to `false`.
* for a `that` mark. It uses an `UntypedTarget` and sets `hasExplicitRange` to `true`.
*
* @param selection The selection with editor to be converted
* @returns A target that can be used for a `that` mark
Expand All @@ -14,5 +13,5 @@ export const selectionToStoredTarget = (selection: SelectionWithEditor) =>
editor: selection.editor,
isReversed: selection.selection.isReversed,
contentRange: selection.selection,
hasExplicitRange: !selection.selection.isEmpty,
hasExplicitRange: true,
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@ export default class PlainTarget extends BaseTarget {
getTrailingDelimiterTarget = () => undefined;
getRemovalRange = () => this.contentRange;

protected getCloneParameters = () => this.state;
protected getCloneParameters() {
return {
...this.state,
isToken: this.isToken,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ export default class PositionTarget extends BaseTarget {
if (
this.insertionDelimiter === "\n" &&
this.position === "after" &&
this.thatTarget.contentRange.isSingleLine
this.state.thatTarget!.contentRange.isSingleLine
) {
// If the target that we're wrapping is not a single line, then we
// want to compute indentation based on the entire target. Otherwise,
// we allow the editor to determine how to perform indentation.
// Note that we use `this.state.thatTarget` rather than `this.thatTarget`
// because we don't really want the transitive `thatTarget` behaviour, as
// it's not really the "that" target that we're after; it's the target that
// we're wrapping. Should rework this stuff as part of #803.
return "insertLineAfter";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,13 @@ export class TestCaseRecorder {
await this.testCase.recordInitialState();

const editor = ide().activeTextEditor!;

if (editor.document.getText().includes("\r\n")) {
throw Error(
"Refusing to record a test when the document contains CRLF line endings. Please convert line endings to LF.",
);
}

// NB: We need to copy the editor options rather than storing a reference
// because its properties are lazy
this.originalTextEditorOptions = { ...editor.options };
Expand Down
1 change: 1 addition & 0 deletions packages/cursorless-engine/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es2020",
"outDir": "out",
"rootDir": "src"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"elseStatement": {
"definitions": [
{
"scope": {
"langIds": [
"python"
]
},
"body": [
"else:",
"\t$body"
]
}
],
"description": "Else branch",
"variables": {
"body": {}
},
"insertionScopeTypes": ["branch"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ finalState:
hasExplicitRange: true
ide:
flashes:
- range:
- style: justAdded
range:
type: character
start: {line: 0, character: 26}
end: {line: 0, character: 37}
style: justAdded
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: argumentOrParameter}}]}]
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ finalState:
hasExplicitRange: true
ide:
flashes:
- range:
- style: justAdded
range:
type: character
start: {line: 0, character: 12}
end: {line: 0, character: 17}
style: justAdded
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: token}}]}]
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ finalState:
hasExplicitRange: true
ide:
flashes:
- range:
- style: justAdded
range:
type: character
start: {line: 0, character: 6}
end: {line: 0, character: 11}
style: justAdded
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: token}}]}]
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ finalState:
hasExplicitRange: true
ide:
flashes:
- range:
- style: justAdded
range:
type: character
start: {line: 0, character: 13}
end: {line: 0, character: 24}
style: justAdded
fullTargets: [{type: primitive, mark: {type: cursor}, modifiers: [{type: containingScope, scopeType: {type: argumentOrParameter}}]}]
Loading

0 comments on commit fed023b

Please sign in to comment.