Open
Description
The problem
Consider the following code
const aaa = 0;
In this case, there is no type. However, we want the following to work:
"change type"
from within the statement should insert a:
after theaaa
and leave your cursor after the:
"bring bat to type air"
should insert a:
after theaaa
, followed by "bat"
The solution
Query language update
-
In our query language, support
@myScopeType.destination
-
Could be used as follows:
( (lexical_declaration (variable_declarator name: (_) @type.destination.endOf !type ) ) (#leading-insertion-delimiter! @type.destination ": ") )
How to handle these queries
The naive approach is to create a stub target that only has a getDestination
method and throws on everything else. Unfortunately the problem is that this would break the following:
function aaa(): void {
const bbb = 0;
}
If you say "copy type bat"
, you'll get an error, because it will get trapped in the pseudo-scope. Maybe that's fine because it could be confusing to have "copy type bat"
and "change type bat"
refer to different scopes (the latter is legitimately a destination pseudo-scope that allows adding a type to bbb
)
Metadata
Metadata
Assignees
Labels
No labels