puppet-editor-services icon indicating copy to clipboard operation
puppet-editor-services copied to clipboard

Feature: Go to Implementation for control-repo

Open magnuslarsen opened this issue 6 years ago • 10 comments

For control-repo's, we have the ability to right-click and press "Go to Definition" on a type/provider, which brings us into the type file. It would be nice to have a similar approach, leveraging the Go to Implementation API, to bring us into the provider file.

I often find myself pressing "Go to Definition", just to bring me the the type, so its easier to find the provider. This would save a couple of clicks :)


As a user/developer

I would like to go to my custom providers easier

so that I don't have to click and scroll after it

magnuslarsen avatar Jun 20 '19 07:06 magnuslarsen

Thanks @magnuslarsen !!

Previously this wasn't possible as we'd need to load providers which is problematic e.g. Linux providers on Windows, HOWEVER with the work in https://github.com/orgs/lingua-pupuli/projects/23 this should be possible, as long as Puppet-Strings knows which types a provider provides for.

glennsarti avatar Jun 20 '19 07:06 glennsarti

Transferring to editor services, as this it where it would be fixed.

glennsarti avatar Jun 20 '19 07:06 glennsarti

Thanks for your awesome work!

Depending on how the final implementation is going to be, it might be worth looking into replacing "Go to Definition" with Go to Type Definition for custom types only. Leaving "Go to Definition" in place for everything else

magnuslarsen avatar Jun 20 '19 07:06 magnuslarsen

Something to watch out for. The link you referenced is for the internal API within VSCode. The Language Server (Puppet Editor Services) implements the Language Server Protocol (LSP) API

https://microsoft.github.io/language-server-protocol/specification

That was added in v3.6 https://microsoft.github.io/language-server-protocol/specification#version_3_6_0

glennsarti avatar Jun 20 '19 08:06 glennsarti

I wonder if there's anything else that needs a Type vs Impl. Definition Provider?

Plans, Functions, Defined Types and Puppet Classes, Data Types, Type Aliases - Nope. Type and Impl. are at the same place Tasks have a separate Type and Impl. (metadata vs actual script)

glennsarti avatar Jun 20 '19 08:06 glennsarti

For later - Link to the differences between the three Goto things

https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition

glennsarti avatar Jun 20 '19 08:06 glennsarti

Another thing that could be nice, is "Go to Definition" for variables. It would become very handy for module classes referencing other classes, i.e.: $my_class::params::my_variable

I now that Ruby Solargraph has implemented this, and the code might be useful? VS Code plugin Solargraph language server

magnuslarsen avatar Jun 20 '19 11:06 magnuslarsen

Hrmm...I think we can do that....

glennsarti avatar Jun 20 '19 11:06 glennsarti

Yet another thing that could be nice, is "Go to Definition" for these functions:

And maybe also for Puppet URI's

magnuslarsen avatar Jul 05 '19 06:07 magnuslarsen

Yet another thing that could be nice, is "Go to Definition" for these functions:

The first thing I tried after installing the language server was using go to definition on lookup which ultimately led me to this issue 🙁

lollipopman avatar Dec 23 '21 19:12 lollipopman