Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type transformation #32

Merged
merged 7 commits into from
Jul 5, 2021
Merged

Conversation

brxck
Copy link
Collaborator

@brxck brxck commented Jun 28, 2021

This should allow referencing type declarations and annotations in Typescript, as I brought up in #24

The transformation can be used on variable declarations, parameters, functions, and properties within type declarations.

This doesn't cover generics, i.e. type parameters or arguments. I started on them, but they complicate things a bit more. Personally I don't think I'm going to miss supporting them at least for now.

Any tweaks or feedback welcome 👍🏼

Closes #24

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!! Tested locally and it works well. I had an idea for some fancy unification; lmk if you can get that approach working / if it seems like a good direction

src/languages/typescript.ts Outdated Show resolved Hide resolved
@brxck
Copy link
Collaborator Author

brxck commented Jun 30, 2021

Got this working with your changes. Pulling out the type node isn't quite as clean as you might hope, but all the pieces seem to fit together nicely.

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome @brxck. I left one more nit to make things slightly clearer but then it's good to go. I can pull it down to mess around with tomorrow my time then I'll ship it

src/nodeMatchers.ts Outdated Show resolved Hide resolved
src/nodeMatchers.ts Outdated Show resolved Hide resolved
@pokey
Copy link
Member

pokey commented Jul 1, 2021

Ok I pulled this one locally and it works pretty well. One that I noticed tho:

export type DecorationMap = {
  [k in SymbolColor]?: vscode.TextEditorDecorationType;
};

If cursor is inside vscode, I think I'd expect it to select vscode.TextEditorDecorationType, but it selects the whole type instead. Is that expected?

@brxck
Copy link
Collaborator Author

brxck commented Jul 1, 2021

Apparently the type of this node is different: opting_type_annotation I hadn't seen that one before. Adding it to getTypeNode seems to handle that as expected.

@pokey pokey mentioned this pull request Jul 3, 2021
2 tasks
@pokey pokey merged commit 5c5256c into cursorless-dev:master Jul 5, 2021
@pokey pokey added this to the First release for new users milestone Jul 6, 2021
@pokey pokey mentioned this pull request Aug 11, 2021
32 tasks
thetomcraig-aya pushed a commit to thetomcraig/cursorless that referenced this pull request Mar 27, 2024
* Added range modifiers till and tween

* renamed til two until
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support "type" transformation
2 participants