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

Go to definition shortcut #174

Closed
rvansa opened this issue Apr 3, 2019 · 6 comments
Closed

Go to definition shortcut #174

rvansa opened this issue Apr 3, 2019 · 6 comments
Assignees
Milestone

Comments

@rvansa
Copy link

rvansa commented Apr 3, 2019

I can't find a way (command, keybinding...) to jump to the schema file, onto element definition to see why the file does not match the template. Is there one?

@evidolob evidolob self-assigned this Jan 13, 2021
@evidolob evidolob added this to the 0.15.0 milestone Jan 13, 2021
@evidolob
Copy link
Collaborator

evidolob commented Jan 13, 2021

@JPinkney I think we can provide CodeLens(something like "Open Schema") for each schema error, when some one click on it we open JSON Schema and navigate to part which causes error.
Or we can provide Code Action With command which will open Schema.
WDYT?

@JPinkney
Copy link
Contributor

I think this makes sense, I think I like the code action a bit more and the code action can be Jump to schema location. There are a few technical issues though. E.g. if a schema is coming from a url how can we jump to location? do we download it to a location then open it etc. Or only provide the code action for local schemas?

@evidolob
Copy link
Collaborator

I think we can download(and we already downloading it for validation) and open in readonly mode

@evidolob
Copy link
Collaborator

evidolob commented Jan 15, 2021

@JPinkney I made a prototype for this issue using CodeActions:

ezgif com-gif-maker (8)
But I face some problems:

  • To be able to open schema in vscode I need to use the latest version of LSP client/server 7.0.0 to use showDocument
  • And file opening works only for local files, demo shows that k8s schema opened in a browser, so all schemas with htttps uri will be opened in a browser. I can handle that by providing custom URI schema and open schema in read only mode, but it would be very VSCode specific.

@JPinkney
Copy link
Contributor

I've never implemented a code action so I'm not exactly sure how they're implemented but what if the flow was something like:

If user is hovering over the error:
    If schema is local schema then:
        show code action and send showDocument request from server to client
    If schema is anything else (contributed using the api or its a schema from the browser) then
        return no code actions available

@evidolob
Copy link
Collaborator

I implement loading JSON Schema content from remote (https) in to vscode editor with custom document content provider:

ezgif com-gif-maker (9)

So yaml-ls trying open document, if uri for it starts with https it changed to json-shema, in vecode extension I add textdocumentcontentprovider which can handle json-shema uri's and return content of schema.

I will create draft PR where we can discuss this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants