mirror of
https://github.com/cursorless-dev/cursorless.git
synced 2024-10-04 04:47:29 +03:00
Merge branch 'main' into pokey/initial-work-towards-next-gen-collectionitem
This commit is contained in:
commit
b86b945607
@ -1,38 +1,44 @@
|
||||
from typing import TypedDict
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
from talon import Module
|
||||
|
||||
|
||||
class SelectionOffsets(TypedDict):
|
||||
anchor: int
|
||||
active: int
|
||||
|
||||
|
||||
class EditorState(TypedDict):
|
||||
text: str
|
||||
selections: list[SelectionOffsets]
|
||||
|
||||
|
||||
class EditorChange(TypedDict):
|
||||
text: str
|
||||
rangeOffset: int
|
||||
rangeLength: int
|
||||
|
||||
|
||||
class EditorEdit(TypedDict):
|
||||
# The new document content after the edit
|
||||
text: str
|
||||
|
||||
# A list of changes that were made to the document. If you can not handle
|
||||
# this, you can ignore it and just replace the entire document with the
|
||||
# value of the `text` field above.
|
||||
changes: list[EditorChange]
|
||||
from talon import Context, Module, actions
|
||||
|
||||
from .cursorless_everywhere_types import EditorEdit, EditorState, SelectionOffsets
|
||||
|
||||
mod = Module()
|
||||
|
||||
mod.tag("cursorless_everywhere_talon", desc="Enable cursorless everywhere in Talon")
|
||||
|
||||
ctx = Context()
|
||||
ctx.matches = r"""
|
||||
tag: user.cursorless_everywhere_talon
|
||||
"""
|
||||
|
||||
|
||||
@ctx.action_class("user")
|
||||
class UserActions:
|
||||
def private_cursorless_run_rpc_command_and_wait(
|
||||
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
|
||||
arg1: Any = None,
|
||||
arg2: Any = None,
|
||||
):
|
||||
actions.user.private_cursorless_talonjs_run_and_wait(command_id, arg1, arg2)
|
||||
|
||||
def private_cursorless_run_rpc_command_no_wait(
|
||||
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
|
||||
arg1: Any = None,
|
||||
arg2: Any = None,
|
||||
):
|
||||
actions.user.private_cursorless_talonjs_run_no_wait(command_id, arg1, arg2)
|
||||
|
||||
def private_cursorless_run_rpc_command_get(
|
||||
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
|
||||
arg1: Any = None,
|
||||
arg2: Any = None,
|
||||
) -> Any:
|
||||
actions.user.private_cursorless_talonjs_run_and_wait(command_id, arg1, arg2)
|
||||
return json.loads(actions.user.private_cursorless_talonjs_get_response_json())
|
||||
|
||||
|
||||
@mod.action_class
|
||||
class Actions:
|
||||
@ -48,3 +54,20 @@ class Actions:
|
||||
edit: EditorEdit, # pyright: ignore [reportGeneralTypeIssues]
|
||||
):
|
||||
"""Edit focused element text"""
|
||||
|
||||
def private_cursorless_talonjs_run_and_wait(
|
||||
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
|
||||
arg1: Any = None,
|
||||
arg2: Any = None,
|
||||
):
|
||||
"""Executes a Cursorless command, waits for its completion, but does not return the response"""
|
||||
|
||||
def private_cursorless_talonjs_run_no_wait(
|
||||
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
|
||||
arg1: Any = None,
|
||||
arg2: Any = None,
|
||||
):
|
||||
"""Executes a Cursorless command, but does not wait for it to finish, nor return the response"""
|
||||
|
||||
def private_cursorless_talonjs_get_response_json() -> str:
|
||||
"""Returns the response from the last Cursorless command"""
|
||||
|
27
cursorless-everywhere-talon/cursorless_everywhere_types.py
Normal file
27
cursorless-everywhere-talon/cursorless_everywhere_types.py
Normal file
@ -0,0 +1,27 @@
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
class SelectionOffsets(TypedDict):
|
||||
anchor: int
|
||||
active: int
|
||||
|
||||
|
||||
class EditorState(TypedDict):
|
||||
text: str
|
||||
selections: list[SelectionOffsets]
|
||||
|
||||
|
||||
class EditorChange(TypedDict):
|
||||
text: str
|
||||
rangeOffset: int
|
||||
rangeLength: int
|
||||
|
||||
|
||||
class EditorEdit(TypedDict):
|
||||
# The new document content after the edit
|
||||
text: str
|
||||
|
||||
# A list of changes that were made to the document. If you can not handle
|
||||
# this, you can ignore it and just replace the entire document with the
|
||||
# value of the `text` field above.
|
||||
changes: list[EditorChange]
|
@ -1,4 +1,10 @@
|
||||
from talon import Context
|
||||
from talon import Context, Module
|
||||
|
||||
mod = Module()
|
||||
mod.list(
|
||||
"cursorless_default_any_alphanumeric_key",
|
||||
desc="Default Cursorless vocabulary any alphanumeric key",
|
||||
)
|
||||
|
||||
ctx = Context()
|
||||
ctx.matches = r"""
|
||||
@ -96,7 +102,7 @@ symbol_key_words = {
|
||||
"pound": "£",
|
||||
}
|
||||
|
||||
any_alphanumeric_keys = {
|
||||
ctx.lists["user.cursorless_default_any_alphanumeric_key"] = {
|
||||
**{w: chr(ord("a") + i) for i, w in enumerate(initial_default_alphabet)},
|
||||
**{digits[i]: str(i) for i in range(10)},
|
||||
**punctuation_words,
|
||||
@ -104,6 +110,10 @@ any_alphanumeric_keys = {
|
||||
}
|
||||
|
||||
|
||||
@ctx.capture("user.any_alphanumeric_key", rule="|".join(any_alphanumeric_keys.keys()))
|
||||
# NB: do not use literals in these captures because `generate_lists_from_capture` does not support them
|
||||
@ctx.capture(
|
||||
"user.any_alphanumeric_key",
|
||||
rule="{user.cursorless_default_any_alphanumeric_key}",
|
||||
)
|
||||
def any_alphanumeric_key(m) -> str:
|
||||
return any_alphanumeric_keys[str(m)]
|
||||
return m.cursorless_default_any_alphanumeric_key
|
||||
|
@ -1,7 +1,7 @@
|
||||
import json
|
||||
from typing import Any, Optional
|
||||
|
||||
from talon import Context, Module, actions, scope
|
||||
from talon import Context, Module, actions, scope, settings
|
||||
|
||||
mod = Module()
|
||||
|
||||
@ -10,6 +10,12 @@ mod.mode(
|
||||
"Used to run tests on the Cursorless spoken forms/grammar",
|
||||
)
|
||||
|
||||
mod.setting(
|
||||
"cursorless_spoken_form_test_restore_microphone",
|
||||
str,
|
||||
desc="The microphone to switch to after the spoken form tests are done. If unset, the microphone that was active before tests started is restored. (If you want to switch back to 'System Default', you should set that as the value here)",
|
||||
)
|
||||
|
||||
ctx = Context()
|
||||
|
||||
ctx.matches = r"""
|
||||
@ -72,7 +78,10 @@ class Actions:
|
||||
|
||||
if enable:
|
||||
saved_modes = scope.get("mode")
|
||||
saved_microphone = actions.sound.active_microphone()
|
||||
saved_microphone = settings.get(
|
||||
"user.cursorless_spoken_form_test_restore_microphone",
|
||||
actions.sound.active_microphone(),
|
||||
)
|
||||
|
||||
disable_modes()
|
||||
actions.mode.enable("user.cursorless_spoken_form_test")
|
||||
|
@ -9,7 +9,8 @@ def get_scopes():
|
||||
"scopeType",
|
||||
{
|
||||
"argumentOrParameter": "Argument",
|
||||
"boundedNonWhitespaceSequence": "Non whitespace sequence stopped by surrounding pair delimeters",
|
||||
"boundedNonWhitespaceSequence": "Non-whitespace sequence bounded by surrounding pair delimeters",
|
||||
"boundedParagraph": "Paragraph bounded by surrounding pair delimeters",
|
||||
},
|
||||
),
|
||||
{
|
||||
|
@ -49,6 +49,14 @@ class SpokenFormEntry:
|
||||
spoken_forms: list[str]
|
||||
|
||||
|
||||
def csv_get_ctx():
|
||||
return ctx
|
||||
|
||||
|
||||
def csv_get_normalized_ctx():
|
||||
return normalized_ctx
|
||||
|
||||
|
||||
def init_csv_and_watch_changes(
|
||||
filename: str,
|
||||
default_values: ListToSpokenForms,
|
||||
|
@ -91,6 +91,9 @@ def get_modifier_callback(modifier: dict) -> Callable:
|
||||
case "containingScope":
|
||||
scope_type_type = modifier["scopeType"]["type"]
|
||||
return get_simple_modifier_callback(f"{modifier_type}.{scope_type_type}")
|
||||
case "preferredScope":
|
||||
scope_type_type = modifier["scopeType"]["type"]
|
||||
return get_simple_modifier_callback(f"containingScope.{scope_type_type}")
|
||||
case "extendThroughStartOf":
|
||||
if "modifiers" not in modifier:
|
||||
return get_simple_modifier_callback(f"{modifier_type}.line")
|
||||
|
@ -4,25 +4,46 @@ from collections import defaultdict
|
||||
from typing import Iterator, Mapping
|
||||
from uu import Error
|
||||
|
||||
from talon import app, registry
|
||||
from talon import app, registry, scope
|
||||
|
||||
from .spoken_forms_output import SpokenFormOutputEntry
|
||||
|
||||
grapheme_capture_name = "user.any_alphanumeric_key"
|
||||
|
||||
|
||||
def get_grapheme_spoken_form_entries() -> list[SpokenFormOutputEntry]:
|
||||
def get_grapheme_spoken_form_entries(
|
||||
grapheme_talon_list: dict[str, str],
|
||||
) -> list[SpokenFormOutputEntry]:
|
||||
return [
|
||||
{
|
||||
"type": "grapheme",
|
||||
"id": id,
|
||||
"spokenForms": spoken_forms,
|
||||
}
|
||||
for symbol_list in generate_lists_from_capture(grapheme_capture_name)
|
||||
for id, spoken_forms in get_id_to_spoken_form_map(symbol_list).items()
|
||||
for id, spoken_forms in talon_list_to_spoken_form_map(
|
||||
grapheme_talon_list
|
||||
).items()
|
||||
]
|
||||
|
||||
|
||||
def get_graphemes_talon_list() -> dict[str, str]:
|
||||
if grapheme_capture_name not in registry.captures:
|
||||
# We require this capture, and expect it to be defined. We want to show a user friendly error if it isn't present (usually indicating a problem with their community.git setup) and we think the user is going to use Cursorless.
|
||||
# However, sometimes users use different dictation engines (Vosk, Webspeech) with entirely different/smaller grammars that don't have the capture, and this code will run then, and falsely error. We don't want to show an error in that case because they don't plan to actually use Cursorless.
|
||||
if "en" in scope.get("language", {}):
|
||||
app.notify(f"Capture <{grapheme_capture_name}> isn't defined")
|
||||
print(
|
||||
f"Capture <{grapheme_capture_name}> isn't defined, which is required by Cursorless. Please check your community setup"
|
||||
)
|
||||
return {}
|
||||
|
||||
return {
|
||||
spoken_form: id
|
||||
for symbol_list in generate_lists_from_capture(grapheme_capture_name)
|
||||
for spoken_form, id in get_id_to_talon_list(symbol_list).items()
|
||||
}
|
||||
|
||||
|
||||
def generate_lists_from_capture(capture_name) -> Iterator[str]:
|
||||
"""
|
||||
Given the name of a capture, yield the names of each list that the capture
|
||||
@ -32,7 +53,8 @@ def generate_lists_from_capture(capture_name) -> Iterator[str]:
|
||||
if capture_name.startswith("self."):
|
||||
capture_name = "user." + capture_name[5:]
|
||||
try:
|
||||
rule = registry.captures[capture_name][0].rule.rule
|
||||
# NB: [-1] because the last capture is the active one
|
||||
rule = registry.captures[capture_name][-1].rule.rule
|
||||
except Error:
|
||||
app.notify("Error constructing spoken forms for graphemes")
|
||||
print(f"Error getting rule for capture {capture_name}")
|
||||
@ -57,19 +79,27 @@ def generate_lists_from_capture(capture_name) -> Iterator[str]:
|
||||
)
|
||||
|
||||
|
||||
def get_id_to_spoken_form_map(list_name: str) -> Mapping[str, list[str]]:
|
||||
def get_id_to_talon_list(list_name: str) -> dict[str, str]:
|
||||
"""
|
||||
Given the name of a Talon list, return a mapping from the values in that
|
||||
list to the list of spoken forms that map to the given value.
|
||||
Given the name of a Talon list, return that list
|
||||
"""
|
||||
try:
|
||||
raw_list = typing.cast(dict[str, str], registry.lists[list_name][0]).copy()
|
||||
# NB: [-1] because the last list is the active one
|
||||
return typing.cast(dict[str, str], registry.lists[list_name][-1]).copy()
|
||||
except Error:
|
||||
app.notify(f"Error getting list {list_name}")
|
||||
return {}
|
||||
|
||||
|
||||
def talon_list_to_spoken_form_map(
|
||||
talon_list: dict[str, str],
|
||||
) -> Mapping[str, list[str]]:
|
||||
"""
|
||||
Given a Talon list, return a mapping from the values in that
|
||||
list to the list of spoken forms that map to the given value.
|
||||
"""
|
||||
inverted_list: defaultdict[str, list[str]] = defaultdict(list)
|
||||
for key, value in raw_list.items():
|
||||
for key, value in talon_list.items():
|
||||
inverted_list[value].append(key)
|
||||
|
||||
return inverted_list
|
||||
|
50
cursorless-talon/src/marks/literal_mark.py
Normal file
50
cursorless-talon/src/marks/literal_mark.py
Normal file
@ -0,0 +1,50 @@
|
||||
from talon import Context, Module
|
||||
|
||||
from .mark_types import LiteralMark
|
||||
|
||||
mod = Module()
|
||||
|
||||
mod.list("private_cursorless_literal_mark", desc="Cursorless literal mark")
|
||||
|
||||
# This is a private tag and should not be used by non Cursorless developers
|
||||
mod.tag(
|
||||
"private_cursorless_literal_mark_no_prefix",
|
||||
desc="Tag for enabling literal mark without prefix",
|
||||
)
|
||||
|
||||
ctx_no_prefix = Context()
|
||||
ctx_no_prefix.matches = r"""
|
||||
tag: user.private_cursorless_literal_mark_no_prefix
|
||||
"""
|
||||
|
||||
|
||||
# NB: <phrase> is used over <user.text> for DFA performance reasons
|
||||
# (we intend to replace this with a dynamic list of document contents eventually)
|
||||
@mod.capture(rule="{user.private_cursorless_literal_mark} <phrase>")
|
||||
def cursorless_literal_mark(m) -> LiteralMark:
|
||||
return construct_mark(str(m.phrase))
|
||||
|
||||
|
||||
@ctx_no_prefix.capture("user.cursorless_literal_mark", rule="<phrase>")
|
||||
def cursorless_literal_mark_no_prefix(m) -> LiteralMark:
|
||||
return construct_mark(str(m.phrase))
|
||||
|
||||
|
||||
def construct_mark(text: str) -> LiteralMark:
|
||||
return {
|
||||
"type": "literal",
|
||||
"modifier": {
|
||||
"type": "preferredScope",
|
||||
"scopeType": {
|
||||
"type": "customRegex",
|
||||
"regex": construct_fuzzy_regex(text),
|
||||
"flags": "gui",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def construct_fuzzy_regex(text: str) -> str:
|
||||
parts = text.split(" ")
|
||||
# Between each word there can be any number of non-alpha symbols (including escape characters: \t\r\n). No separator at all is also valid -- for example, when searching for a camelCase identifier.
|
||||
return r"([^a-zA-Z]|\\[trn])*".join(parts)
|
@ -8,6 +8,7 @@ mod = Module()
|
||||
@mod.capture(
|
||||
rule=(
|
||||
"<user.cursorless_decorated_symbol> | "
|
||||
"<user.cursorless_literal_mark> | "
|
||||
"<user.cursorless_simple_mark> |"
|
||||
"<user.cursorless_line_number>" # row (ie absolute mod 100), up, down
|
||||
)
|
||||
|
@ -7,6 +7,11 @@ class DecoratedSymbol(TypedDict):
|
||||
character: str
|
||||
|
||||
|
||||
class LiteralMark(TypedDict):
|
||||
type: Literal["literal"]
|
||||
modifier: dict
|
||||
|
||||
|
||||
SimpleMark = dict[Literal["type"], str]
|
||||
|
||||
LineNumberType = Literal["modulo100", "relative"]
|
||||
@ -28,4 +33,4 @@ class LineNumberRange(TypedDict):
|
||||
|
||||
LineNumber = Union[LineNumberMark, LineNumberRange]
|
||||
|
||||
Mark = Union[DecoratedSymbol, SimpleMark, LineNumber]
|
||||
Mark = Union[DecoratedSymbol, LiteralMark, SimpleMark, LineNumber]
|
||||
|
@ -1,30 +0,0 @@
|
||||
from talon import Module
|
||||
|
||||
mod = Module()
|
||||
|
||||
mod.list(
|
||||
"cursorless_glyph_scope_type",
|
||||
desc="Cursorless glyph scope type",
|
||||
)
|
||||
mod.list(
|
||||
"cursorless_glyph_scope_type_plural",
|
||||
desc="Plural version of Cursorless glyph scope type",
|
||||
)
|
||||
|
||||
|
||||
@mod.capture(rule="{user.cursorless_glyph_scope_type} <user.any_alphanumeric_key>")
|
||||
def cursorless_glyph_scope_type(m) -> dict[str, str]:
|
||||
return {
|
||||
"type": "glyph",
|
||||
"character": m.any_alphanumeric_key,
|
||||
}
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule="{user.cursorless_glyph_scope_type_plural} <user.any_alphanumeric_key>"
|
||||
)
|
||||
def cursorless_glyph_scope_type_plural(m) -> dict[str, str]:
|
||||
return {
|
||||
"type": "glyph",
|
||||
"character": m.any_alphanumeric_key,
|
||||
}
|
@ -27,7 +27,6 @@ head_tail_swallowed_modifiers = [
|
||||
"<user.cursorless_simple_scope_modifier>", # funk, state, class, every funk
|
||||
"<user.cursorless_ordinal_scope>", # first past second word
|
||||
"<user.cursorless_relative_scope>", # next funk, 3 funks
|
||||
"<user.cursorless_surrounding_pair_force_direction>", # DEPRECATED "left quad" / "right quad"
|
||||
]
|
||||
|
||||
modifiers = [
|
||||
|
@ -4,6 +4,25 @@ mod = Module()
|
||||
|
||||
mod.list("cursorless_scope_type", desc="Supported scope types")
|
||||
mod.list("cursorless_scope_type_plural", desc="Supported plural scope types")
|
||||
|
||||
mod.list(
|
||||
"cursorless_glyph_scope_type",
|
||||
desc="Cursorless glyph scope type",
|
||||
)
|
||||
mod.list(
|
||||
"cursorless_glyph_scope_type_plural",
|
||||
desc="Plural version of Cursorless glyph scope type",
|
||||
)
|
||||
|
||||
mod.list(
|
||||
"cursorless_surrounding_pair_scope_type",
|
||||
desc="Scope types that can function as surrounding pairs",
|
||||
)
|
||||
mod.list(
|
||||
"cursorless_surrounding_pair_scope_type_plural",
|
||||
desc="Plural form of scope types that can function as surrounding pairs",
|
||||
)
|
||||
|
||||
mod.list(
|
||||
"cursorless_custom_regex_scope_type",
|
||||
desc="Supported custom regular expression scope types",
|
||||
@ -13,60 +32,49 @@ mod.list(
|
||||
desc="Supported plural custom regular expression scope types",
|
||||
)
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule="{user.cursorless_scope_type}"
|
||||
" | <user.cursorless_surrounding_pair_scope_type>"
|
||||
" | <user.cursorless_glyph_scope_type>"
|
||||
" | {user.cursorless_custom_regex_scope_type}"
|
||||
mod.list(
|
||||
"cursorless_scope_type_flattened",
|
||||
desc="All supported scope types flattened",
|
||||
)
|
||||
mod.list(
|
||||
"cursorless_scope_type_flattened_plural",
|
||||
desc="All supported plural scope types flattened",
|
||||
)
|
||||
|
||||
|
||||
@mod.capture(rule="{user.cursorless_scope_type_flattened}")
|
||||
def cursorless_scope_type(m) -> dict[str, str]:
|
||||
"""Cursorless scope type singular"""
|
||||
try:
|
||||
return {"type": m.cursorless_scope_type}
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
return m.cursorless_surrounding_pair_scope_type
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
return m.cursorless_glyph_scope_type
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
return {
|
||||
"type": "customRegex",
|
||||
"regex": m.cursorless_custom_regex_scope_type,
|
||||
}
|
||||
return creates_scope_type(m.cursorless_scope_type_flattened)
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule="{user.cursorless_scope_type_plural}"
|
||||
" | <user.cursorless_surrounding_pair_scope_type_plural>"
|
||||
" | <user.cursorless_glyph_scope_type_plural>"
|
||||
" | {user.cursorless_custom_regex_scope_type_plural}"
|
||||
)
|
||||
@mod.capture(rule="{user.cursorless_scope_type_flattened_plural}")
|
||||
def cursorless_scope_type_plural(m) -> dict[str, str]:
|
||||
"""Cursorless scope type plural"""
|
||||
try:
|
||||
return {"type": m.cursorless_scope_type_plural}
|
||||
except AttributeError:
|
||||
pass
|
||||
return creates_scope_type(m.cursorless_scope_type_flattened_plural)
|
||||
|
||||
try:
|
||||
return m.cursorless_surrounding_pair_scope_type_plural
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
return m.cursorless_glyph_scope_type_plural
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
return {
|
||||
"type": "customRegex",
|
||||
"regex": m.cursorless_custom_regex_scope_type_plural,
|
||||
}
|
||||
def creates_scope_type(id: str) -> dict[str, str]:
|
||||
grouping, value = id.split(".", 1)
|
||||
match grouping:
|
||||
case "simple":
|
||||
return {
|
||||
"type": value,
|
||||
}
|
||||
case "surroundingPair":
|
||||
return {
|
||||
"type": "surroundingPair",
|
||||
"delimiter": value,
|
||||
}
|
||||
case "customRegex":
|
||||
return {
|
||||
"type": "customRegex",
|
||||
"regex": value,
|
||||
}
|
||||
case "glyph":
|
||||
return {
|
||||
"type": "glyph",
|
||||
"character": value,
|
||||
}
|
||||
case _:
|
||||
raise ValueError(f"Unsupported scope type grouping: {grouping}")
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Any
|
||||
|
||||
from talon import Module
|
||||
from talon import Module, settings
|
||||
|
||||
mod = Module()
|
||||
|
||||
@ -13,6 +13,13 @@ mod.list(
|
||||
desc="Cursorless ancestor scope modifiers",
|
||||
)
|
||||
|
||||
# This is a private setting and should not be used by non Cursorless developers
|
||||
mod.setting(
|
||||
"private_cursorless_use_preferred_scope",
|
||||
bool,
|
||||
desc="Use preferred scope instead of containing scope for all scopes by default (EXPERIMENTAL)",
|
||||
)
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule=(
|
||||
@ -35,6 +42,12 @@ def cursorless_simple_scope_modifier(m) -> dict[str, Any]:
|
||||
"ancestorIndex": 1,
|
||||
}
|
||||
|
||||
if settings.get("user.private_cursorless_use_preferred_scope", False):
|
||||
return {
|
||||
"type": "preferredScope",
|
||||
"scopeType": m.cursorless_scope_type,
|
||||
}
|
||||
|
||||
return {
|
||||
"type": "containingScope",
|
||||
"scopeType": m.cursorless_scope_type,
|
||||
|
@ -1,80 +0,0 @@
|
||||
from contextlib import suppress
|
||||
from typing import Any
|
||||
|
||||
from talon import Context, Module
|
||||
|
||||
mod = Module()
|
||||
ctx = Context()
|
||||
|
||||
|
||||
mod.list(
|
||||
"cursorless_delimiter_force_direction",
|
||||
desc="DEPRECATED: Can be used to force an ambiguous delimiter to extend in one direction",
|
||||
)
|
||||
# FIXME: Remove type ignore once Talon supports list types
|
||||
# See https://github.com/talonvoice/talon/issues/654
|
||||
ctx.lists["user.cursorless_delimiter_force_direction"] = [ # pyright: ignore [reportArgumentType]
|
||||
"left",
|
||||
"right",
|
||||
]
|
||||
|
||||
mod.list(
|
||||
"cursorless_surrounding_pair_scope_type",
|
||||
desc="Scope types that can function as surrounding pairs",
|
||||
)
|
||||
mod.list(
|
||||
"cursorless_surrounding_pair_scope_type_plural",
|
||||
desc="Plural form of scope types that can function as surrounding pairs",
|
||||
)
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule=(
|
||||
"<user.cursorless_selectable_paired_delimiter> |"
|
||||
"{user.cursorless_surrounding_pair_scope_type}"
|
||||
)
|
||||
)
|
||||
def cursorless_surrounding_pair_scope_type(m) -> dict[str, str]:
|
||||
"""Surrounding pair scope type"""
|
||||
try:
|
||||
delimiter = m.cursorless_surrounding_pair_scope_type
|
||||
except AttributeError:
|
||||
delimiter = m.cursorless_selectable_paired_delimiter
|
||||
return {
|
||||
"type": "surroundingPair",
|
||||
"delimiter": delimiter,
|
||||
}
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule=(
|
||||
"<user.cursorless_selectable_paired_delimiter_plural> |"
|
||||
"{user.cursorless_surrounding_pair_scope_type_plural}"
|
||||
)
|
||||
)
|
||||
def cursorless_surrounding_pair_scope_type_plural(m) -> dict[str, str]:
|
||||
"""Plural surrounding pair scope type"""
|
||||
try:
|
||||
delimiter = m.cursorless_surrounding_pair_scope_type_plural
|
||||
except AttributeError:
|
||||
delimiter = m.cursorless_selectable_paired_delimiter_plural
|
||||
return {
|
||||
"type": "surroundingPair",
|
||||
"delimiter": delimiter,
|
||||
}
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule="{user.cursorless_delimiter_force_direction} <user.cursorless_surrounding_pair_scope_type>"
|
||||
)
|
||||
def cursorless_surrounding_pair_force_direction(m) -> dict[str, Any]:
|
||||
"""DEPRECATED: Expand to containing surrounding pair"""
|
||||
scope_type = m.cursorless_surrounding_pair_scope_type
|
||||
|
||||
with suppress(AttributeError):
|
||||
scope_type["forceDirection"] = m.cursorless_delimiter_force_direction
|
||||
|
||||
return {
|
||||
"type": "containingScope",
|
||||
"scopeType": scope_type,
|
||||
}
|
@ -54,29 +54,3 @@ def cursorless_wrapper_paired_delimiter(m) -> list[str]:
|
||||
except AttributeError:
|
||||
id = m.cursorless_wrapper_selectable_paired_delimiter
|
||||
return paired_delimiters[id]
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule=(
|
||||
"{user.cursorless_selectable_only_paired_delimiter} |"
|
||||
"{user.cursorless_wrapper_selectable_paired_delimiter}"
|
||||
)
|
||||
)
|
||||
def cursorless_selectable_paired_delimiter(m) -> str:
|
||||
try:
|
||||
return m.cursorless_selectable_only_paired_delimiter
|
||||
except AttributeError:
|
||||
return m.cursorless_wrapper_selectable_paired_delimiter
|
||||
|
||||
|
||||
@mod.capture(
|
||||
rule=(
|
||||
"{user.cursorless_selectable_only_paired_delimiter_plural} |"
|
||||
"{user.cursorless_wrapper_selectable_paired_delimiter_plural}"
|
||||
)
|
||||
)
|
||||
def cursorless_selectable_paired_delimiter_plural(m) -> str:
|
||||
try:
|
||||
return m.cursorless_selectable_only_paired_delimiter_plural
|
||||
except AttributeError:
|
||||
return m.cursorless_wrapper_selectable_paired_delimiter_plural
|
||||
|
@ -13,10 +13,12 @@ from .csv_overrides import (
|
||||
)
|
||||
from .get_grapheme_spoken_form_entries import (
|
||||
get_grapheme_spoken_form_entries,
|
||||
get_graphemes_talon_list,
|
||||
grapheme_capture_name,
|
||||
)
|
||||
from .marks.decorated_mark import init_hats
|
||||
from .spoken_forms_output import SpokenFormsOutput
|
||||
from .spoken_scope_forms import init_scope_spoken_forms
|
||||
|
||||
JSON_FILE = Path(__file__).parent / "spoken_forms.json"
|
||||
disposables: list[Callable] = []
|
||||
@ -99,6 +101,7 @@ def update():
|
||||
custom_spoken_forms: dict[str, list[SpokenFormEntry]] = {}
|
||||
spoken_forms_output = SpokenFormsOutput()
|
||||
spoken_forms_output.init()
|
||||
graphemes_talon_list = get_graphemes_talon_list()
|
||||
|
||||
def update_spoken_forms_output():
|
||||
spoken_forms_output.write(
|
||||
@ -113,7 +116,7 @@ def update():
|
||||
for entry in spoken_form_list
|
||||
if entry.list_name in LIST_TO_TYPE_MAP
|
||||
],
|
||||
*get_grapheme_spoken_form_entries(),
|
||||
*get_grapheme_spoken_form_entries(graphemes_talon_list),
|
||||
]
|
||||
)
|
||||
|
||||
@ -122,6 +125,7 @@ def update():
|
||||
if initialized:
|
||||
# On first run, we just do one update at the end, so we suppress
|
||||
# writing until we get there
|
||||
init_scope_spoken_forms(graphemes_talon_list)
|
||||
update_spoken_forms_output()
|
||||
|
||||
handle_csv = auto_construct_defaults(
|
||||
@ -193,6 +197,7 @@ def update():
|
||||
),
|
||||
]
|
||||
|
||||
init_scope_spoken_forms(graphemes_talon_list)
|
||||
update_spoken_forms_output()
|
||||
initialized = True
|
||||
|
||||
|
49
cursorless-talon/src/spoken_scope_forms.py
Normal file
49
cursorless-talon/src/spoken_scope_forms.py
Normal file
@ -0,0 +1,49 @@
|
||||
from talon import Context, scope
|
||||
|
||||
from .csv_overrides import csv_get_ctx, csv_get_normalized_ctx
|
||||
|
||||
|
||||
def init_scope_spoken_forms(graphemes_talon_list: dict[str, str]):
|
||||
create_flattened_talon_list(csv_get_ctx(), graphemes_talon_list)
|
||||
if is_cursorless_test_mode():
|
||||
create_flattened_talon_list(csv_get_normalized_ctx(), graphemes_talon_list)
|
||||
|
||||
|
||||
def create_flattened_talon_list(ctx: Context, graphemes_talon_list: dict[str, str]):
|
||||
lists_to_merge = {
|
||||
"cursorless_scope_type": "simple",
|
||||
"cursorless_surrounding_pair_scope_type": "surroundingPair",
|
||||
"cursorless_selectable_only_paired_delimiter": "surroundingPair",
|
||||
"cursorless_wrapper_selectable_paired_delimiter": "surroundingPair",
|
||||
}
|
||||
# If the user have no custom regex scope type, then that list is missing from the context
|
||||
if "user.cursorless_custom_regex_scope_type" in ctx.lists.keys(): # noqa: SIM118
|
||||
lists_to_merge["cursorless_custom_regex_scope_type"] = "customRegex"
|
||||
|
||||
scope_types_singular: dict[str, str] = {}
|
||||
scope_types_plural: dict[str, str] = {}
|
||||
|
||||
for list_name, prefix in lists_to_merge.items():
|
||||
for key, value in ctx.lists[f"user.{list_name}"].items():
|
||||
scope_types_singular[key] = f"{prefix}.{value}"
|
||||
for key, value in ctx.lists[f"user.{list_name}_plural"].items():
|
||||
scope_types_plural[key] = f"{prefix}.{value}"
|
||||
|
||||
glyph_singular_spoken_forms = ctx.lists["user.cursorless_glyph_scope_type"]
|
||||
glyph_plural_spoken_forms = ctx.lists["user.cursorless_glyph_scope_type_plural"]
|
||||
|
||||
for grapheme_key, grapheme_value in graphemes_talon_list.items():
|
||||
value = f"glyph.{grapheme_value}"
|
||||
for glyph in glyph_singular_spoken_forms:
|
||||
key = f"{glyph} {grapheme_key}"
|
||||
scope_types_singular[key] = value
|
||||
for glyph in glyph_plural_spoken_forms:
|
||||
key = f"{glyph} {grapheme_key}"
|
||||
scope_types_plural[key] = value
|
||||
|
||||
ctx.lists["user.cursorless_scope_type_flattened"] = scope_types_singular
|
||||
ctx.lists["user.cursorless_scope_type_flattened_plural"] = scope_types_plural
|
||||
|
||||
|
||||
def is_cursorless_test_mode():
|
||||
return "user.cursorless_spoken_form_test" in scope.get("mode")
|
@ -11,7 +11,15 @@ mod = Module()
|
||||
)
|
||||
)
|
||||
def cursorless_primitive_target(m) -> PrimitiveTarget:
|
||||
return PrimitiveTarget(
|
||||
getattr(m, "cursorless_mark", None),
|
||||
getattr(m, "cursorless_modifier_list", None),
|
||||
)
|
||||
mark = getattr(m, "cursorless_mark", None)
|
||||
modifiers = getattr(m, "cursorless_modifier_list", None)
|
||||
|
||||
# for grammar performance reasons, the literal modifier is exposed to Talon as a mark,
|
||||
# but is converted to a modifier in the engine.
|
||||
if mark is not None and mark["type"] == "literal":
|
||||
if modifiers is None:
|
||||
modifiers = []
|
||||
modifiers.append(mark["modifier"])
|
||||
mark = None
|
||||
|
||||
return PrimitiveTarget(mark, modifiers)
|
||||
|
37
data/fixtures/recorded/languages/kotlin/changeArg.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeArg.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun display(name: String, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 14}
|
||||
active: {line: 5, character: 14}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun display(name: String, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(, age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 12}
|
||||
active: {line: 5, character: 12}
|
41
data/fixtures/recorded/languages/kotlin/changeArg10.yml
Normal file
41
data/fixtures/recorded/languages/kotlin/changeArg10.yml
Normal file
@ -0,0 +1,41 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
fun performOperation(x: Int, y: Int, operation: (Int, Int) -> Int): Int {
|
||||
return operation(x, y)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val result = performOperation(5, 3) { a, b ->
|
||||
a + b
|
||||
}
|
||||
println(result) // Output: 8
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 40}
|
||||
active: {line: 5, character: 40}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
fun performOperation(x: Int, y: Int, operation: (Int, Int) -> Int): Int {
|
||||
return operation(x, y)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val result = performOperation(5, 3)
|
||||
println(result) // Output: 8
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 40}
|
||||
active: {line: 5, character: 40}
|
41
data/fixtures/recorded/languages/kotlin/changeArg11.yml
Normal file
41
data/fixtures/recorded/languages/kotlin/changeArg11.yml
Normal file
@ -0,0 +1,41 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
fun performOperation(operation: (Int, Int) -> Int): Int {
|
||||
return operation(0, 1)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val result = performOperation { a, b ->
|
||||
a + b
|
||||
}
|
||||
println(result) // Output: 8
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 34}
|
||||
active: {line: 5, character: 34}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
fun performOperation(operation: (Int, Int) -> Int): Int {
|
||||
return operation(0, 1)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val result = performOperation
|
||||
println(result) // Output: 8
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 34}
|
||||
active: {line: 5, character: 34}
|
23
data/fixtures/recorded/languages/kotlin/changeArg12.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeArg12.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "class Person(val firstName: String, var isEmployed: Boolean = true)"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 13}
|
||||
active: {line: 0, character: 13}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: "class Person(, var isEmployed: Boolean = true)"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 13}
|
||||
active: {line: 0, character: 13}
|
23
data/fixtures/recorded/languages/kotlin/changeArg13.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeArg13.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "class Person(val firstName: String, var isEmployed: Boolean = true)"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 37}
|
||||
active: {line: 0, character: 37}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: "class Person(val firstName: String, )"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 36}
|
||||
active: {line: 0, character: 36}
|
37
data/fixtures/recorded/languages/kotlin/changeArg14.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeArg14.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Person {
|
||||
var name: String = ""
|
||||
get(): String = field
|
||||
set(value: String): Unit {
|
||||
field = value
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 14}
|
||||
active: {line: 3, character: 14}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Person {
|
||||
var name: String = ""
|
||||
get(): String = field
|
||||
set(): Unit {
|
||||
field = value
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 12}
|
||||
active: {line: 3, character: 12}
|
23
data/fixtures/recorded/languages/kotlin/changeArg15.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeArg15.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "val lambda = { x: Int -> x * 2 }"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 20}
|
||||
active: {line: 0, character: 20}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: val lambda = { -> x * 2 }
|
||||
selections:
|
||||
- anchor: {line: 0, character: 15}
|
||||
active: {line: 0, character: 15}
|
33
data/fixtures/recorded/languages/kotlin/changeArg2.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeArg2.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class A : B() {}
|
||||
|
||||
class C(param: Int) : D(param)
|
||||
|
||||
class D : SomeInterface
|
||||
selections:
|
||||
- anchor: {line: 2, character: 29}
|
||||
active: {line: 2, character: 29}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class A : B() {}
|
||||
|
||||
class C(param: Int) : D()
|
||||
|
||||
class D : SomeInterface
|
||||
selections:
|
||||
- anchor: {line: 2, character: 24}
|
||||
active: {line: 2, character: 24}
|
29
data/fixtures/recorded/languages/kotlin/changeArg3.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeArg3.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test(x: Int, y: Int) {
|
||||
constructor() : this(0, 0)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 25}
|
||||
active: {line: 1, character: 25}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test(x: Int, y: Int) {
|
||||
constructor() : this(, 0)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 25}
|
||||
active: {line: 1, character: 25}
|
33
data/fixtures/recorded/languages/kotlin/changeArg4.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeArg4.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
enum class Color(val hex: String) {
|
||||
RED("#FF0000"),
|
||||
GREEN("#00FF00"),
|
||||
BLUE("#0000FF")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 8}
|
||||
active: {line: 1, character: 8}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
enum class Color(val hex: String) {
|
||||
RED(),
|
||||
GREEN("#00FF00"),
|
||||
BLUE("#0000FF")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 8}
|
||||
active: {line: 1, character: 8}
|
37
data/fixtures/recorded/languages/kotlin/changeArg5.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeArg5.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String = "true", age: Int = 1) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 17}
|
||||
active: {line: 0, character: 17}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun display(, age: Int = 1) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 12}
|
||||
active: {line: 0, character: 12}
|
37
data/fixtures/recorded/languages/kotlin/changeArg6.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeArg6.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String = "true", age: Int = 1) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 43}
|
||||
active: {line: 0, character: 43}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String = "true", ) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 42}
|
||||
active: {line: 0, character: 42}
|
37
data/fixtures/recorded/languages/kotlin/changeArg7.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeArg7.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 29}
|
||||
active: {line: 0, character: 29}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun display(, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 12}
|
||||
active: {line: 0, character: 12}
|
37
data/fixtures/recorded/languages/kotlin/changeArg8.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeArg8.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 36}
|
||||
active: {line: 0, character: 36}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String, ) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 33}
|
||||
active: {line: 0, character: 33}
|
37
data/fixtures/recorded/languages/kotlin/changeArg9.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeArg9.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String, vararg age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 40}
|
||||
active: {line: 0, character: 40}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String, ) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 33}
|
||||
active: {line: 0, character: 33}
|
55
data/fixtures/recorded/languages/kotlin/changeBranch.yml
Normal file
55
data/fixtures/recorded/languages/kotlin/changeBranch.yml
Normal file
@ -0,0 +1,55 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change branch
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: branch}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 20}
|
||||
active: {line: 5, character: 20}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 12}
|
||||
active: {line: 5, character: 12}
|
33
data/fixtures/recorded/languages/kotlin/changeBranch2.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeBranch2.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change branch
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: branch}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 12}
|
||||
active: {line: 1, character: 12}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 4}
|
||||
active: {line: 1, character: 4}
|
33
data/fixtures/recorded/languages/kotlin/changeBranch3.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeBranch3.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change branch
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: branch}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 12}
|
||||
active: {line: 3, character: 12}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0
|
||||
|
||||
else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 4}
|
||||
active: {line: 3, character: 4}
|
29
data/fixtures/recorded/languages/kotlin/changeBranch4.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeBranch4.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change branch
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: branch}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0 else if (false) 1 else -1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 18}
|
||||
active: {line: 1, character: 18}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0 else -1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 16}
|
||||
active: {line: 1, character: 16}
|
29
data/fixtures/recorded/languages/kotlin/changeBranch5.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeBranch5.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change branch
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: branch}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0 else if (false) 1 else -1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 37}
|
||||
active: {line: 1, character: 37}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0 else if (false) 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 34}
|
||||
active: {line: 1, character: 34}
|
55
data/fixtures/recorded/languages/kotlin/changeCall.yml
Normal file
55
data/fixtures/recorded/languages/kotlin/changeCall.yml
Normal file
@ -0,0 +1,55 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change call
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionCall}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 18}
|
||||
active: {line: 3, character: 18}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s =
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 16}
|
||||
active: {line: 3, character: 16}
|
33
data/fixtures/recorded/languages/kotlin/changeCall2.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeCall2.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change call
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionCall}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class A : B() {}
|
||||
|
||||
class C(param: Int) : D(param)
|
||||
|
||||
class D : SomeInterface
|
||||
selections:
|
||||
- anchor: {line: 2, character: 25}
|
||||
active: {line: 2, character: 25}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class A : B() {}
|
||||
|
||||
class C(param: Int) :
|
||||
|
||||
class D : SomeInterface
|
||||
selections:
|
||||
- anchor: {line: 2, character: 22}
|
||||
active: {line: 2, character: 22}
|
29
data/fixtures/recorded/languages/kotlin/changeCall3.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeCall3.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change call
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionCall}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test(x: Int, y: Int) {
|
||||
constructor() : this(0, 0)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 25}
|
||||
active: {line: 1, character: 25}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test(x: Int, y: Int) {
|
||||
constructor() :
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 18}
|
||||
active: {line: 1, character: 18}
|
33
data/fixtures/recorded/languages/kotlin/changeCall4.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeCall4.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change call
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionCall}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
enum class Color(val hex: String) {
|
||||
RED("#FF0000"),
|
||||
GREEN("#00FF00"),
|
||||
BLUE("#0000FF")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 4}
|
||||
active: {line: 2, character: 4}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
enum class Color(val hex: String) {
|
||||
RED("#FF0000"),
|
||||
,
|
||||
BLUE("#0000FF")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 4}
|
||||
active: {line: 2, character: 4}
|
39
data/fixtures/recorded/languages/kotlin/changeCallee.yml
Normal file
39
data/fixtures/recorded/languages/kotlin/changeCallee.yml
Normal file
@ -0,0 +1,39 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change callee
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionCallee}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
fun <T> convertToString(value: T): String {
|
||||
return value.toString()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val stringValue: String = convertToString<Int>(42)
|
||||
println(stringValue)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 54}
|
||||
active: {line: 5, character: 54}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
fun <T> convertToString(value: T): String {
|
||||
return value.toString()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val stringValue: String = (42)
|
||||
println(stringValue)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 30}
|
||||
active: {line: 5, character: 30}
|
33
data/fixtures/recorded/languages/kotlin/changeCallee2.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeCallee2.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change callee
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionCallee}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class A : B() {}
|
||||
|
||||
class C(param: Int) : D(param)
|
||||
|
||||
class D : SomeInterface
|
||||
selections:
|
||||
- anchor: {line: 2, character: 30}
|
||||
active: {line: 2, character: 30}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class A : B() {}
|
||||
|
||||
class C(param: Int) : (param)
|
||||
|
||||
class D : SomeInterface
|
||||
selections:
|
||||
- anchor: {line: 2, character: 22}
|
||||
active: {line: 2, character: 22}
|
29
data/fixtures/recorded/languages/kotlin/changeCallee3.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeCallee3.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change callee
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionCallee}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test(x: Int, y: Int) {
|
||||
constructor() : this(0, 0)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 30}
|
||||
active: {line: 1, character: 30}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test(x: Int, y: Int) {
|
||||
constructor() : (0, 0)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 20}
|
||||
active: {line: 1, character: 20}
|
33
data/fixtures/recorded/languages/kotlin/changeCallee4.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeCallee4.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change callee
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionCallee}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
enum class Color(val hex: String) {
|
||||
RED("#FF0000"),
|
||||
GREEN("#00FF00"),
|
||||
BLUE("#0000FF")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 18}
|
||||
active: {line: 1, character: 18}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
enum class Color(val hex: String) {
|
||||
("#FF0000"),
|
||||
GREEN("#00FF00"),
|
||||
BLUE("#0000FF")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 4}
|
||||
active: {line: 1, character: 4}
|
41
data/fixtures/recorded/languages/kotlin/changeClass.yml
Normal file
41
data/fixtures/recorded/languages/kotlin/changeClass.yml
Normal file
@ -0,0 +1,41 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change class
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: class}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 2}
|
||||
active: {line: 1, character: 2}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 0}
|
40
data/fixtures/recorded/languages/kotlin/changeClass2.yml
Normal file
40
data/fixtures/recorded/languages/kotlin/changeClass2.yml
Normal file
@ -0,0 +1,40 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change class
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: class}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 8, character: 0}
|
||||
active: {line: 8, character: 0}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |+
|
||||
class HelloWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
selections:
|
||||
- anchor: {line: 6, character: 0}
|
||||
active: {line: 6, character: 0}
|
45
data/fixtures/recorded/languages/kotlin/changeClassName.yml
Normal file
45
data/fixtures/recorded/languages/kotlin/changeClassName.yml
Normal file
@ -0,0 +1,45 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change class name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: className}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 0}
|
||||
active: {line: 2, character: 0}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 6}
|
||||
active: {line: 0, character: 6}
|
45
data/fixtures/recorded/languages/kotlin/changeClassName2.yml
Normal file
45
data/fixtures/recorded/languages/kotlin/changeClassName2.yml
Normal file
@ -0,0 +1,45 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change class name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: className}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 8, character: 0}
|
||||
active: {line: 8, character: 0}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 6, character: 7}
|
||||
active: {line: 6, character: 7}
|
33
data/fixtures/recorded/languages/kotlin/changeClassName3.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeClassName3.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change class name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: className}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
class MyClass {
|
||||
companion object NamedCompanion {
|
||||
fun greet() = "Hello!"
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 30}
|
||||
active: {line: 2, character: 30}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
class MyClass {
|
||||
companion object {
|
||||
fun greet() = "Hello!"
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 21}
|
||||
active: {line: 1, character: 21}
|
31
data/fixtures/recorded/languages/kotlin/changeComment.yml
Normal file
31
data/fixtures/recorded/languages/kotlin/changeComment.yml
Normal file
@ -0,0 +1,31 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change comment
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: comment}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
// thoughtful comment
|
||||
fun main() {
|
||||
println("Hello, world!!!")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 21}
|
||||
active: {line: 0, character: 21}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
|
||||
fun main() {
|
||||
println("Hello, world!!!")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 0}
|
55
data/fixtures/recorded/languages/kotlin/changeCondition.yml
Normal file
55
data/fixtures/recorded/languages/kotlin/changeCondition.yml
Normal file
@ -0,0 +1,55 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 22}
|
||||
active: {line: 5, character: 22}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
-> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 12}
|
||||
active: {line: 5, character: 12}
|
@ -0,0 +1,43 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
// while loops
|
||||
fun main() {
|
||||
print("test")
|
||||
while (false) {
|
||||
print("while")
|
||||
}
|
||||
do {
|
||||
print("do")
|
||||
} while (false)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 4, character: 8}
|
||||
active: {line: 4, character: 8}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
// while loops
|
||||
fun main() {
|
||||
print("test")
|
||||
while () {
|
||||
print("while")
|
||||
}
|
||||
do {
|
||||
print("do")
|
||||
} while (false)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 11}
|
||||
active: {line: 3, character: 11}
|
@ -0,0 +1,43 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
// while loops
|
||||
fun main() {
|
||||
print("test")
|
||||
while (false) {
|
||||
print("while")
|
||||
}
|
||||
do {
|
||||
print("do")
|
||||
} while (false)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 7, character: 10}
|
||||
active: {line: 7, character: 10}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
// while loops
|
||||
fun main() {
|
||||
print("test")
|
||||
while (false) {
|
||||
print("while")
|
||||
}
|
||||
do {
|
||||
print("do")
|
||||
} while ()
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 8, character: 13}
|
||||
active: {line: 8, character: 13}
|
@ -0,0 +1,43 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun describeColor(color: String): String {
|
||||
return when (color) {
|
||||
"red", "blue", "green" -> "Primary color"
|
||||
"yellow", "orange" -> "Secondary color"
|
||||
"black", "white" -> "Neutral color"
|
||||
else -> "Unknown color"
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 49}
|
||||
active: {line: 2, character: 49}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun describeColor(color: String): String {
|
||||
return when (color) {
|
||||
, , -> "Primary color"
|
||||
"yellow", "orange" -> "Secondary color"
|
||||
"black", "white" -> "Neutral color"
|
||||
else -> "Unknown color"
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 8}
|
||||
active: {line: 2, character: 8}
|
||||
- anchor: {line: 2, character: 10}
|
||||
active: {line: 2, character: 10}
|
||||
- anchor: {line: 2, character: 12}
|
||||
active: {line: 2, character: 12}
|
49
data/fixtures/recorded/languages/kotlin/changeCondition2.yml
Normal file
49
data/fixtures/recorded/languages/kotlin/changeCondition2.yml
Normal file
@ -0,0 +1,49 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 13}
|
||||
active: {line: 1, character: 13}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if ();
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 8}
|
||||
active: {line: 1, character: 8}
|
49
data/fixtures/recorded/languages/kotlin/changeCondition3.yml
Normal file
49
data/fixtures/recorded/languages/kotlin/changeCondition3.yml
Normal file
@ -0,0 +1,49 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 15}
|
||||
active: {line: 3, character: 15}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if () 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 8}
|
||||
active: {line: 3, character: 8}
|
49
data/fixtures/recorded/languages/kotlin/changeCondition4.yml
Normal file
49
data/fixtures/recorded/languages/kotlin/changeCondition4.yml
Normal file
@ -0,0 +1,49 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 13}
|
||||
active: {line: 5, character: 13}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if () else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 8}
|
||||
active: {line: 5, character: 8}
|
49
data/fixtures/recorded/languages/kotlin/changeCondition5.yml
Normal file
49
data/fixtures/recorded/languages/kotlin/changeCondition5.yml
Normal file
@ -0,0 +1,49 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 7, character: 15}
|
||||
active: {line: 7, character: 15}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if () 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 7, character: 8}
|
||||
active: {line: 7, character: 8}
|
49
data/fixtures/recorded/languages/kotlin/changeCondition6.yml
Normal file
49
data/fixtures/recorded/languages/kotlin/changeCondition6.yml
Normal file
@ -0,0 +1,49 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 9, character: 13}
|
||||
active: {line: 9, character: 13}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if () else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 9, character: 8}
|
||||
active: {line: 9, character: 8}
|
49
data/fixtures/recorded/languages/kotlin/changeCondition7.yml
Normal file
49
data/fixtures/recorded/languages/kotlin/changeCondition7.yml
Normal file
@ -0,0 +1,49 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if (true) 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 11, character: 14}
|
||||
active: {line: 11, character: 14}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true);
|
||||
|
||||
if (true) 0
|
||||
|
||||
if (true) else;
|
||||
|
||||
if (true) 0 else;
|
||||
|
||||
if (true) else 1
|
||||
|
||||
if () 0 else 1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 11, character: 8}
|
||||
active: {line: 11, character: 8}
|
29
data/fixtures/recorded/languages/kotlin/changeCondition8.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeCondition8.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0 else if (false) 1 else -1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 17}
|
||||
active: {line: 1, character: 17}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
if (true) 0 else if () 1 else -1
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 25}
|
||||
active: {line: 1, character: 25}
|
55
data/fixtures/recorded/languages/kotlin/changeCondition9.yml
Normal file
55
data/fixtures/recorded/languages/kotlin/changeCondition9.yml
Normal file
@ -0,0 +1,55 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 8, character: 16}
|
||||
active: {line: 8, character: 16}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
-> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 7, character: 12}
|
||||
active: {line: 7, character: 12}
|
39
data/fixtures/recorded/languages/kotlin/changeEveryArg.yml
Normal file
39
data/fixtures/recorded/languages/kotlin/changeEveryArg.yml
Normal file
@ -0,0 +1,39 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun display(name: String, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 9}
|
||||
active: {line: 5, character: 9}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun display(name: String, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(, )
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 12}
|
||||
active: {line: 5, character: 12}
|
||||
- anchor: {line: 5, character: 14}
|
||||
active: {line: 5, character: 14}
|
39
data/fixtures/recorded/languages/kotlin/changeEveryArg2.yml
Normal file
39
data/fixtures/recorded/languages/kotlin/changeEveryArg2.yml
Normal file
@ -0,0 +1,39 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun display(vararg name: String, vararg age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 8}
|
||||
active: {line: 0, character: 8}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun display(, ) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 12}
|
||||
active: {line: 0, character: 12}
|
||||
- anchor: {line: 0, character: 14}
|
||||
active: {line: 0, character: 14}
|
25
data/fixtures/recorded/languages/kotlin/changeEveryArg3.yml
Normal file
25
data/fixtures/recorded/languages/kotlin/changeEveryArg3.yml
Normal file
@ -0,0 +1,25 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "class Person(val firstName: String, var isEmployed: Boolean = true)"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 0}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: class Person(, )
|
||||
selections:
|
||||
- anchor: {line: 0, character: 13}
|
||||
active: {line: 0, character: 13}
|
||||
- anchor: {line: 0, character: 15}
|
||||
active: {line: 0, character: 15}
|
37
data/fixtures/recorded/languages/kotlin/changeEveryArg4.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeEveryArg4.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Person {
|
||||
var name: String = ""
|
||||
get(): String = field
|
||||
set(value: String): Unit {
|
||||
field = value
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 8}
|
||||
active: {line: 3, character: 8}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Person {
|
||||
var name: String = ""
|
||||
get(): String = field
|
||||
set(): Unit {
|
||||
field = value
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 12}
|
||||
active: {line: 3, character: 12}
|
25
data/fixtures/recorded/languages/kotlin/changeEveryArg5.yml
Normal file
25
data/fixtures/recorded/languages/kotlin/changeEveryArg5.yml
Normal file
@ -0,0 +1,25 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every arg
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: argumentOrParameter}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "val lambda = { x: Int, y: Int -> x * y }"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 34}
|
||||
active: {line: 0, character: 34}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: val lambda = { , -> x * y }
|
||||
selections:
|
||||
- anchor: {line: 0, character: 15}
|
||||
active: {line: 0, character: 15}
|
||||
- anchor: {line: 0, character: 17}
|
||||
active: {line: 0, character: 17}
|
@ -0,0 +1,57 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every branch
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: branch}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 32}
|
||||
active: {line: 5, character: 32}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 12}
|
||||
active: {line: 5, character: 12}
|
||||
- anchor: {line: 6, character: 12}
|
||||
active: {line: 6, character: 12}
|
||||
- anchor: {line: 7, character: 12}
|
||||
active: {line: 7, character: 12}
|
@ -0,0 +1,59 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every condition
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: condition}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 32}
|
||||
active: {line: 5, character: 32}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
-> print("x == 1")
|
||||
-> print("x == 2")
|
||||
-> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 12}
|
||||
active: {line: 5, character: 12}
|
||||
- anchor: {line: 6, character: 12}
|
||||
active: {line: 6, character: 12}
|
||||
- anchor: {line: 7, character: 12}
|
||||
active: {line: 7, character: 12}
|
31
data/fixtures/recorded/languages/kotlin/changeEveryItem.yml
Normal file
31
data/fixtures/recorded/languages/kotlin/changeEveryItem.yml
Normal file
@ -0,0 +1,31 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every item
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: collectionItem}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
val map = mapOf(1 to "x", 2 to "y", -1 to "zz")
|
||||
val list = listOf(1, 2, 3)
|
||||
selections:
|
||||
- anchor: {line: 0, character: 19}
|
||||
active: {line: 0, character: 19}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
val map = mapOf(, , )
|
||||
val list = listOf(1, 2, 3)
|
||||
selections:
|
||||
- anchor: {line: 0, character: 16}
|
||||
active: {line: 0, character: 16}
|
||||
- anchor: {line: 0, character: 18}
|
||||
active: {line: 0, character: 18}
|
||||
- anchor: {line: 0, character: 20}
|
||||
active: {line: 0, character: 20}
|
31
data/fixtures/recorded/languages/kotlin/changeEveryItem2.yml
Normal file
31
data/fixtures/recorded/languages/kotlin/changeEveryItem2.yml
Normal file
@ -0,0 +1,31 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every item
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: collectionItem}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
val map = mapOf(1 to "x", 2 to "y", -1 to "zz")
|
||||
val list = listOf(1, 2, 3)
|
||||
selections:
|
||||
- anchor: {line: 1, character: 19}
|
||||
active: {line: 1, character: 19}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
val map = mapOf(1 to "x", 2 to "y", -1 to "zz")
|
||||
val list = listOf(, , )
|
||||
selections:
|
||||
- anchor: {line: 1, character: 18}
|
||||
active: {line: 1, character: 18}
|
||||
- anchor: {line: 1, character: 20}
|
||||
active: {line: 1, character: 20}
|
||||
- anchor: {line: 1, character: 22}
|
||||
active: {line: 1, character: 22}
|
31
data/fixtures/recorded/languages/kotlin/changeEveryName.yml
Normal file
31
data/fixtures/recorded/languages/kotlin/changeEveryName.yml
Normal file
@ -0,0 +1,31 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val (x, y) = Pair(1, 2)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 27}
|
||||
active: {line: 1, character: 27}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val (, ) = Pair(1, 2)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 9}
|
||||
active: {line: 1, character: 9}
|
||||
- anchor: {line: 1, character: 11}
|
||||
active: {line: 1, character: 11}
|
39
data/fixtures/recorded/languages/kotlin/changeEveryName2.yml
Normal file
39
data/fixtures/recorded/languages/kotlin/changeEveryName2.yml
Normal file
@ -0,0 +1,39 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val pairs = listOf(Pair(1, "one"), Pair(2, "two"), Pair(3, "three"))
|
||||
|
||||
for ((number, name) in pairs) {
|
||||
println("Number: $number, Name: $name")
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 4, character: 47}
|
||||
active: {line: 4, character: 47}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val pairs = listOf(Pair(1, "one"), Pair(2, "two"), Pair(3, "three"))
|
||||
|
||||
for ((, ) in pairs) {
|
||||
println("Number: $number, Name: $name")
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 10}
|
||||
active: {line: 3, character: 10}
|
||||
- anchor: {line: 3, character: 12}
|
||||
active: {line: 3, character: 12}
|
31
data/fixtures/recorded/languages/kotlin/changeEveryType.yml
Normal file
31
data/fixtures/recorded/languages/kotlin/changeEveryType.yml
Normal file
@ -0,0 +1,31 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change every type
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: everyScope
|
||||
scopeType: {type: type}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val (x: Int, y: Int) = Pair(1, 2)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 41}
|
||||
active: {line: 1, character: 41}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val (x: , y: ) = Pair(1, 2)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 16}
|
||||
active: {line: 1, character: 16}
|
||||
- anchor: {line: 1, character: 21}
|
||||
active: {line: 1, character: 21}
|
45
data/fixtures/recorded/languages/kotlin/changeFunk.yml
Normal file
45
data/fixtures/recorded/languages/kotlin/changeFunk.yml
Normal file
@ -0,0 +1,45 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change funk
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: namedFunction}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 3}
|
||||
active: {line: 1, character: 3}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 2}
|
||||
active: {line: 1, character: 2}
|
33
data/fixtures/recorded/languages/kotlin/changeFunk2.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeFunk2.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change funk
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: namedFunction}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test(x: Int, y: Int) {
|
||||
constructor() : this(0, 0)
|
||||
|
||||
fun a() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 11}
|
||||
active: {line: 1, character: 11}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test(x: Int, y: Int) {
|
||||
|
||||
|
||||
fun a() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 2}
|
||||
active: {line: 1, character: 2}
|
45
data/fixtures/recorded/languages/kotlin/changeFunkName.yml
Normal file
45
data/fixtures/recorded/languages/kotlin/changeFunkName.yml
Normal file
@ -0,0 +1,45 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change funk name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: functionName}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 3}
|
||||
active: {line: 1, character: 3}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class HelloWorld {
|
||||
fun () {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
object GoodbyeWorld {
|
||||
fun a() {}
|
||||
|
||||
fun b() {}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 6}
|
||||
active: {line: 1, character: 6}
|
53
data/fixtures/recorded/languages/kotlin/changeIfState.yml
Normal file
53
data/fixtures/recorded/languages/kotlin/changeIfState.yml
Normal file
@ -0,0 +1,53 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change if state
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: ifStatement}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 12, character: 16}
|
||||
active: {line: 12, character: 16}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 11, character: 8}
|
||||
active: {line: 11, character: 8}
|
23
data/fixtures/recorded/languages/kotlin/changeKey.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeKey.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change key
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: collectionKey}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "fun main() {\n\tval map = mapOf(1 to \"x\", 2 to \"y\", -1 to \"zz\")\n\tprintln(map) // {1=x, 2=y, -1=zz}\n}"
|
||||
selections:
|
||||
- anchor: {line: 1, character: 33}
|
||||
active: {line: 1, character: 33}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: "fun main() {\n\tval map = mapOf(1 to \"x\", to \"y\", -1 to \"zz\")\n\tprintln(map) // {1=x, 2=y, -1=zz}\n}"
|
||||
selections:
|
||||
- anchor: {line: 1, character: 27}
|
||||
active: {line: 1, character: 27}
|
55
data/fixtures/recorded/languages/kotlin/changeLambda.yml
Normal file
55
data/fixtures/recorded/languages/kotlin/changeLambda.yml
Normal file
@ -0,0 +1,55 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change lambda
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: anonymousFunction}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f = fun(i: Int, j: Int) { i + j }
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 38}
|
||||
active: {line: 2, character: 38}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
class Test {
|
||||
fun main() {
|
||||
val f =
|
||||
val s = f(1, 2)
|
||||
when (s) {
|
||||
1 -> print("x == 1")
|
||||
2 -> print("x == 2")
|
||||
else -> {
|
||||
print("x is neither 1 nor 2")
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 16}
|
||||
active: {line: 2, character: 16}
|
23
data/fixtures/recorded/languages/kotlin/changeLambda2.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeLambda2.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change lambda
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: anonymousFunction}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "val lambda = { x: Int -> x * 2 }"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 26}
|
||||
active: {line: 0, character: 26}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: "val lambda = "
|
||||
selections:
|
||||
- anchor: {line: 0, character: 13}
|
||||
active: {line: 0, character: 13}
|
29
data/fixtures/recorded/languages/kotlin/changeName.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeName.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun add(a: Int, b: Int) {
|
||||
return a + b;
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 12}
|
||||
active: {line: 0, character: 12}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun add(: Int, b: Int) {
|
||||
return a + b;
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 8}
|
||||
active: {line: 0, character: 8}
|
29
data/fixtures/recorded/languages/kotlin/changeName10.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeName10.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
fun greet(name: String) {
|
||||
println("Hello, $name!")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 18}
|
||||
active: {line: 0, character: 18}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
fun greet(: String) {
|
||||
println("Hello, $name!")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 10}
|
||||
active: {line: 0, character: 10}
|
37
data/fixtures/recorded/languages/kotlin/changeName11.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeName11.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
try {
|
||||
val result = 10 / 0
|
||||
} catch (e: ArithmeticException) {
|
||||
println("Division by zero!")
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 4, character: 36}
|
||||
active: {line: 4, character: 36}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
try {
|
||||
val result = 10 / 0
|
||||
} catch (: ArithmeticException) {
|
||||
println("Division by zero!")
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 3, character: 13}
|
||||
active: {line: 3, character: 13}
|
23
data/fixtures/recorded/languages/kotlin/changeName12.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeName12.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "fun main() {\n var name: String\n\tname = \"Kotlin\"\n}"
|
||||
selections:
|
||||
- anchor: {line: 2, character: 16}
|
||||
active: {line: 2, character: 16}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: "fun main() {\n var name: String\n\t = \"Kotlin\"\n}"
|
||||
selections:
|
||||
- anchor: {line: 2, character: 1}
|
||||
active: {line: 2, character: 1}
|
37
data/fixtures/recorded/languages/kotlin/changeName13.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeName13.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
fun display(name: String, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display(name = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 23}
|
||||
active: {line: 5, character: 23}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
fun display(name: String, age: Int) {
|
||||
println("Name: $name, Age: $age")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
display( = "Alice", age = 25)
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 5, character: 12}
|
||||
active: {line: 5, character: 12}
|
29
data/fixtures/recorded/languages/kotlin/changeName2.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeName2.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val f = { a: Int, b: Int -> a + b }
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 20}
|
||||
active: {line: 1, character: 20}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val f = { : Int, b: Int -> a + b }
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 14}
|
||||
active: {line: 1, character: 14}
|
23
data/fixtures/recorded/languages/kotlin/changeName3.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeName3.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: typealias Predicate<T> = (T) -> Boolean
|
||||
selections:
|
||||
- anchor: {line: 0, character: 0}
|
||||
active: {line: 0, character: 0}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: typealias = (T) -> Boolean
|
||||
selections:
|
||||
- anchor: {line: 0, character: 10}
|
||||
active: {line: 0, character: 10}
|
23
data/fixtures/recorded/languages/kotlin/changeName4.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeName4.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "class Person(val firstName: String, var isEmployed: Boolean = true)"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 14}
|
||||
active: {line: 0, character: 14}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: "class Person(val : String, var isEmployed: Boolean = true)"
|
||||
selections:
|
||||
- anchor: {line: 0, character: 17}
|
||||
active: {line: 0, character: 17}
|
33
data/fixtures/recorded/languages/kotlin/changeName5.yml
Normal file
33
data/fixtures/recorded/languages/kotlin/changeName5.yml
Normal file
@ -0,0 +1,33 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
class MyClass {
|
||||
companion object NamedCompanion {
|
||||
fun greet() = "Hello!"
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 37}
|
||||
active: {line: 1, character: 37}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
class MyClass {
|
||||
companion object {
|
||||
fun greet() = "Hello!"
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 21}
|
||||
active: {line: 1, character: 21}
|
31
data/fixtures/recorded/languages/kotlin/changeName6.yml
Normal file
31
data/fixtures/recorded/languages/kotlin/changeName6.yml
Normal file
@ -0,0 +1,31 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
fun sum(a: Int, b: Int): Int {
|
||||
val result: Int = a + b
|
||||
return result
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 27}
|
||||
active: {line: 1, character: 27}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
fun sum(a: Int, b: Int): Int {
|
||||
val : Int = a + b
|
||||
return result
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 8}
|
||||
active: {line: 1, character: 8}
|
23
data/fixtures/recorded/languages/kotlin/changeName7.yml
Normal file
23
data/fixtures/recorded/languages/kotlin/changeName7.yml
Normal file
@ -0,0 +1,23 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: "fun main() {\n for (i: Int in 1..10) {\n \tprintln(i)\n }\n}"
|
||||
selections:
|
||||
- anchor: {line: 2, character: 15}
|
||||
active: {line: 2, character: 15}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: "fun main() {\n for (: Int in 1..10) {\n \tprintln(i)\n }\n}"
|
||||
selections:
|
||||
- anchor: {line: 1, character: 9}
|
||||
active: {line: 1, character: 9}
|
37
data/fixtures/recorded/languages/kotlin/changeName8.yml
Normal file
37
data/fixtures/recorded/languages/kotlin/changeName8.yml
Normal file
@ -0,0 +1,37 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val x = 5
|
||||
when (val result: Int = x * 2) {
|
||||
10 -> println("Ten")
|
||||
else -> println("Not ten")
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 33}
|
||||
active: {line: 2, character: 33}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
val x = 5
|
||||
when (val : Int = x * 2) {
|
||||
10 -> println("Ten")
|
||||
else -> println("Not ten")
|
||||
}
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 14}
|
||||
active: {line: 2, character: 14}
|
29
data/fixtures/recorded/languages/kotlin/changeName9.yml
Normal file
29
data/fixtures/recorded/languages/kotlin/changeName9.yml
Normal file
@ -0,0 +1,29 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change name
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: name}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |
|
||||
fun greet(name: String = "World") {
|
||||
println("Hello, $name!")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 29}
|
||||
active: {line: 0, character: 29}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |
|
||||
fun greet(: String = "World") {
|
||||
println("Hello, $name!")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 0, character: 10}
|
||||
active: {line: 0, character: 10}
|
31
data/fixtures/recorded/languages/kotlin/changeRound.yml
Normal file
31
data/fixtures/recorded/languages/kotlin/changeRound.yml
Normal file
@ -0,0 +1,31 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change round
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: surroundingPair, delimiter: parentheses}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
// my (test) function
|
||||
print("hello (test) world")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 13}
|
||||
active: {line: 1, character: 13}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
// my function
|
||||
print("hello (test) world")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 1, character: 10}
|
||||
active: {line: 1, character: 10}
|
31
data/fixtures/recorded/languages/kotlin/changeRound2.yml
Normal file
31
data/fixtures/recorded/languages/kotlin/changeRound2.yml
Normal file
@ -0,0 +1,31 @@
|
||||
languageId: kotlin
|
||||
command:
|
||||
version: 7
|
||||
spokenForm: change round
|
||||
action:
|
||||
name: clearAndSetSelection
|
||||
target:
|
||||
type: primitive
|
||||
modifiers:
|
||||
- type: containingScope
|
||||
scopeType: {type: surroundingPair, delimiter: parentheses}
|
||||
usePrePhraseSnapshot: true
|
||||
initialState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
// my (test) function
|
||||
print("hello (test) world")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 22}
|
||||
active: {line: 2, character: 22}
|
||||
marks: {}
|
||||
finalState:
|
||||
documentContents: |-
|
||||
fun main() {
|
||||
// my (test) function
|
||||
print("hello world")
|
||||
}
|
||||
selections:
|
||||
- anchor: {line: 2, character: 17}
|
||||
active: {line: 2, character: 17}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user