-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Multiple TS files for Find All references , Peek Definition #64
Comments
That's something the standalone editor doesn't support and there are no plans to do so. It would require to introduce the notion of a project and to have access to arbitrary files of that project. |
I was able to make this work across files with just a few hacks. First add all the files with both of these functions:
Then I hacked into the require function of the loader to monkey patch how the internals find the other file reference.
|
Great!, But I could not make it work. Do you have a working sample? function xhr(url) {
xhr('file1.ts').then(function(res) {
monaco.editor.createModel("file1.ts","typescript");
xhr('file2.ts').then(function(res) {
monaco.editor.createModel("file2.ts","typescript");
|
It has to load all the files into addExtraLib first before createModel. Also your params on createModel are wrong.
I'll be making my app public soon. |
I got it partially working by adding : |
Check for errors. The default implementation crashes which is why that monkey patch above is needed. |
I added the monkey patch in different places and added the breakpoint to it, but it seems, the code is never been called. I added your code at the end of loader.js and also in the page before calling this: require.config({ paths: { 'vs': 'node_modules/monaco-editor/dev/vs' }}); Also, I added the code after " var RequireFunc = (function ... " line 1807 in loader.js, but I got some error. |
Yes setup the patch before require.config then call require on the specific modules that need to be patched. Here's what I have right now as a React component. |
Thanks, I used the code, and now it breaks in "SimpleEditorService.prototype.findModel " patch. It does not work yet, one of the error is : |
Here's my full app http://run.primoca.com |
Great, I checked it without local ipfs. |
Is it possible to register multiple files , like file1.ts , file2.ts and files3.ts, then use "Peek Definition" or
"Find All references" commands in File1.ts and able to see the result from all the 3 files?
Currently, it works for loaded code in editor.
Obviously , I am asking to have similar functionality of VSCode.
Thanks
The text was updated successfully, but these errors were encountered: