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 does not work? #2402

Closed
ivan-prodanov opened this issue Mar 22, 2021 · 2 comments
Closed

Go To Definition does not work? #2402

ivan-prodanov opened this issue Mar 22, 2021 · 2 comments

Comments

@ivan-prodanov
Copy link

ivan-prodanov commented Mar 22, 2021

I was reading this issue (#291) as I was having the same problem. Essentially my DefinitionProvider calls monaco.editor.createModel with a uri and code and then returns this uri in the Location object. However, the editor won't switch to the newly created model. Go to Definition only works in peek definition.

I found this fix, which is quite impractical as I'm using TypeScript.

I also found this suggestion from @alexdima.

Last but not least, I saw what the Eclipse guys are doing with Theia. Pretty much manually adding the type definitions.

I was thinking the last several days what the most pragmatic and practical solution could be. Is this a bug in Monaco? If it's not a bug and we are required to extend the current services, can we get the type definitions, perhaps, in a separate package?

Context about my project: Static Monaco webpage running OmniSharp's roslyn backend (The C# extension for VS Code) in WebAssembly within a worker. The editor communicates directly with WebAssembly for every single provider available through the worker. It all works like magic, except "Go To Definition" :(

Edit: I'm specifically talking about intermodel "Go To Definition". The feature works very well if the definition is within the the current model.

@spahnke
Copy link
Contributor

spahnke commented Mar 23, 2021

See #2000 (comment) for thoughts on this and a possible workaround for you. Basically, there currently is no official API to do this in a meaningful way and without breaking most (I think) use-cases.

@ivan-prodanov
Copy link
Author

@spahnke thank you, this somewhat works. I opened another issue because line/column is not respected from the DefinitionProvider.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants