Skip to content

Add Go To Implementation Api - #18346

Merged
Matt Bierner (mjbvz) merged 3 commits into
microsoft:masterfrom
mjbvz:add-got-to-implementation-provider
Jan 12, 2017
Merged

Matt Bierner (mjbvz) merged 3 commits into
microsoft:masterfrom
mjbvz:add-got-to-implementation-provider

Conversation

@mjbvz

Copy link
Copy Markdown
Contributor

Fixes #10806

Adds a new API for supporting go to implementation type commands in languages. Implements an example for TS

The current approach added a new public interface called ImplementationProvider (a suggestions for a better name would be appreciated). This resulted in some duplicate code that I will try to clean up further. An alternate design would be to extend the DefintionProvider with an optional provideImplemtnation method. This would allow reusing our existing internal interfaces without as much duplication, but we may want to keep the two concepts separate. Please let me know if you have any thoughts one way or the other.

For microsoft#10806

Adds a new API for supporting  `go to implementation` command for languages. Implements an example for TS
@bpasero

Copy link
Copy Markdown
Contributor

Removing myself from reviewer, unless there is a very specific reason why my feedback is needed in this area. Please let me know.

precondition: ModeContextKeys.hasImplementationProvider,
kbOpts: {
kbExpr: EditorContextKeys.TextFocus,
primary: KeyMod.CtrlCmd | KeyCode.F12

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

conflicts with Find References

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok. Visual Studio uses alt+f12 for "go to implementation" but we already have a binding for that to editor.action.previewDeclaration. I don't see any default binding for cmd+f12 though, but am not sure how this would on other platforms. Any suggestions for an unused keybinding that would work on all platforms well?

Comment thread src/vs/vscode.d.ts
/**
* The implementation provider interface defines the contract between extensions and
* the go to implementation feature.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe TypeDefinitionProvider would be a better name?

@jrieken

Copy link
Copy Markdown
Contributor

Good stuff - added some nit comments, ignored the actual implementation in the TypeScript extensions.

I would definitely go for a separate provider despite them being quite similar. My name proposal is TypeDefinitionProvider.

@dbaeumer

Copy link
Copy Markdown
Member

+1 for the separate provider. Name wise I would go with TypeOfDefintionProvider :-)

Matt Bierner added 2 commits January 10, 2017 13:04
@mjbvz

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I've updated the interface names and am looking into the keybindings

@mjbvz

Copy link
Copy Markdown
Contributor Author

Dirk Bäumer (@dbaeumer) The language service API should probably pick up support for this feature, but I wanted to check with you to see that should block this PR. I think we can either:

  • Ship this new API as part of VSCode 1.9 and update the language server API to support it later
  • Hold off on shipping this API in VSCode until we can update the language service API to also support it

What are your thoughts on this?

@dbaeumer

Copy link
Copy Markdown
Member

Matt Bierner (@mjbvz) we always ship new API in VS Code and then update the LSP later. Can you please file n issue here https://github.com/Microsoft/language-server-protocol so I don't forget to do it.

@mjbvz

Copy link
Copy Markdown
Contributor Author

@mjbvz
Matt Bierner (mjbvz) merged commit 9d611d4 into microsoft:master Jan 12, 2017
Matt Bierner (mjbvz) pushed a commit to mjbvz/vscode that referenced this pull request Jan 23, 2017
**bug**
In microsoft#18346, I originally called the new go to implementation provider api `ImplementationProvider` which we then decided to rename to `TypeDefinitionProvider`. At the time, I didn't realize that a type definition was actually its own, unrelated concept.

**Fix**
Rename `TypeDefinitionProvider` to `TypeImplementationProvider` to make it clear what the purpose and use of this api is.
Matt Bierner (mjbvz) pushed a commit that referenced this pull request Jan 24, 2017
* Rename TypeDefinitionProvider to TypeImeplementationProvider

**bug**
In #18346, I originally called the new go to implementation provider api `ImplementationProvider` which we then decided to rename to `TypeDefinitionProvider`. At the time, I didn't realize that a type definition was actually its own, unrelated concept.

**Fix**
Rename `TypeDefinitionProvider` to `TypeImplementationProvider` to make it clear what the purpose and use of this api is.

* Fix a few names in comments
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Suggestion: Go to implementation

6 participants