Should I register my entire source code base as text models in monaco-editor?












0














I'm working on a small cloud IDE for an in-house language using monaco editor as the code editor.



In order to make features like "Find All References" , which work across source files via uri's, work , is it the idea that I register all the source files as ITextModel's in the editor? Or is there some hook that when the ReferenceProvider tool item is clicked , will allow to load up a text model on the fly?










share|improve this question



























    0














    I'm working on a small cloud IDE for an in-house language using monaco editor as the code editor.



    In order to make features like "Find All References" , which work across source files via uri's, work , is it the idea that I register all the source files as ITextModel's in the editor? Or is there some hook that when the ReferenceProvider tool item is clicked , will allow to load up a text model on the fly?










    share|improve this question

























      0












      0








      0







      I'm working on a small cloud IDE for an in-house language using monaco editor as the code editor.



      In order to make features like "Find All References" , which work across source files via uri's, work , is it the idea that I register all the source files as ITextModel's in the editor? Or is there some hook that when the ReferenceProvider tool item is clicked , will allow to load up a text model on the fly?










      share|improve this question













      I'm working on a small cloud IDE for an in-house language using monaco editor as the code editor.



      In order to make features like "Find All References" , which work across source files via uri's, work , is it the idea that I register all the source files as ITextModel's in the editor? Or is there some hook that when the ReferenceProvider tool item is clicked , will allow to load up a text model on the fly?







      vscode-extensions monaco-editor






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 17 '18 at 16:30









      Maxm007

      66821020




      66821020
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I was stuck with the same problem until a few days ago, and the answer to me was for your question was NO. You do not register all your source code as ITextModel's. Not even VSCode does that.



          I stumbled upon this repo a few days ago. The code was written 2 years ago and is obsolete, but none the less is still really helpful and with minor adjustments you can get it working in no time. The actual code spans multiple files and functions and it may not be practical to write it here, follow the link for the actual code. But perhaps this is what you're looking for monaco.languages.registerReferenceProvider;






          share|improve this answer





















          • Hi. So I understand monaco.languages.registerReferenceProvider produces the locations for the current model, let's say uri://sourcefile1. Now let's say this file imports a method from from another file uri://sourcefile2 and users does a "Find References" on that method, we know from our SymbolTable that the source location for that method is in uri://sourcefile2. However, Monaco editor isn't aware of this file, so either it needs to be registered with monaco as a model, or there is some hook that we can handle which will load the model.
            – Maxm007
            Nov 18 '18 at 22:28










          • Sorry for the late response. Quite honestly, I'm still working on it this week. But my best guess is we use the result from the reference provider and add models dynamically at that time. I'll post a more elaborate answer here once I'm done with it. In the meantime, have you found the solution?
            – Nishkal Kashyap
            Nov 20 '18 at 4:01










          • not yet. I'm blocked on dev work for the moment to even enable find references for a single file. If I hit it first, I will definitely update on here.
            – Maxm007
            Nov 22 '18 at 11:46











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353173%2fshould-i-register-my-entire-source-code-base-as-text-models-in-monaco-editor%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I was stuck with the same problem until a few days ago, and the answer to me was for your question was NO. You do not register all your source code as ITextModel's. Not even VSCode does that.



          I stumbled upon this repo a few days ago. The code was written 2 years ago and is obsolete, but none the less is still really helpful and with minor adjustments you can get it working in no time. The actual code spans multiple files and functions and it may not be practical to write it here, follow the link for the actual code. But perhaps this is what you're looking for monaco.languages.registerReferenceProvider;






          share|improve this answer





















          • Hi. So I understand monaco.languages.registerReferenceProvider produces the locations for the current model, let's say uri://sourcefile1. Now let's say this file imports a method from from another file uri://sourcefile2 and users does a "Find References" on that method, we know from our SymbolTable that the source location for that method is in uri://sourcefile2. However, Monaco editor isn't aware of this file, so either it needs to be registered with monaco as a model, or there is some hook that we can handle which will load the model.
            – Maxm007
            Nov 18 '18 at 22:28










          • Sorry for the late response. Quite honestly, I'm still working on it this week. But my best guess is we use the result from the reference provider and add models dynamically at that time. I'll post a more elaborate answer here once I'm done with it. In the meantime, have you found the solution?
            – Nishkal Kashyap
            Nov 20 '18 at 4:01










          • not yet. I'm blocked on dev work for the moment to even enable find references for a single file. If I hit it first, I will definitely update on here.
            – Maxm007
            Nov 22 '18 at 11:46
















          0














          I was stuck with the same problem until a few days ago, and the answer to me was for your question was NO. You do not register all your source code as ITextModel's. Not even VSCode does that.



          I stumbled upon this repo a few days ago. The code was written 2 years ago and is obsolete, but none the less is still really helpful and with minor adjustments you can get it working in no time. The actual code spans multiple files and functions and it may not be practical to write it here, follow the link for the actual code. But perhaps this is what you're looking for monaco.languages.registerReferenceProvider;






          share|improve this answer





















          • Hi. So I understand monaco.languages.registerReferenceProvider produces the locations for the current model, let's say uri://sourcefile1. Now let's say this file imports a method from from another file uri://sourcefile2 and users does a "Find References" on that method, we know from our SymbolTable that the source location for that method is in uri://sourcefile2. However, Monaco editor isn't aware of this file, so either it needs to be registered with monaco as a model, or there is some hook that we can handle which will load the model.
            – Maxm007
            Nov 18 '18 at 22:28










          • Sorry for the late response. Quite honestly, I'm still working on it this week. But my best guess is we use the result from the reference provider and add models dynamically at that time. I'll post a more elaborate answer here once I'm done with it. In the meantime, have you found the solution?
            – Nishkal Kashyap
            Nov 20 '18 at 4:01










          • not yet. I'm blocked on dev work for the moment to even enable find references for a single file. If I hit it first, I will definitely update on here.
            – Maxm007
            Nov 22 '18 at 11:46














          0












          0








          0






          I was stuck with the same problem until a few days ago, and the answer to me was for your question was NO. You do not register all your source code as ITextModel's. Not even VSCode does that.



          I stumbled upon this repo a few days ago. The code was written 2 years ago and is obsolete, but none the less is still really helpful and with minor adjustments you can get it working in no time. The actual code spans multiple files and functions and it may not be practical to write it here, follow the link for the actual code. But perhaps this is what you're looking for monaco.languages.registerReferenceProvider;






          share|improve this answer












          I was stuck with the same problem until a few days ago, and the answer to me was for your question was NO. You do not register all your source code as ITextModel's. Not even VSCode does that.



          I stumbled upon this repo a few days ago. The code was written 2 years ago and is obsolete, but none the less is still really helpful and with minor adjustments you can get it working in no time. The actual code spans multiple files and functions and it may not be practical to write it here, follow the link for the actual code. But perhaps this is what you're looking for monaco.languages.registerReferenceProvider;







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 18 '18 at 5:32









          Nishkal Kashyap

          23719




          23719












          • Hi. So I understand monaco.languages.registerReferenceProvider produces the locations for the current model, let's say uri://sourcefile1. Now let's say this file imports a method from from another file uri://sourcefile2 and users does a "Find References" on that method, we know from our SymbolTable that the source location for that method is in uri://sourcefile2. However, Monaco editor isn't aware of this file, so either it needs to be registered with monaco as a model, or there is some hook that we can handle which will load the model.
            – Maxm007
            Nov 18 '18 at 22:28










          • Sorry for the late response. Quite honestly, I'm still working on it this week. But my best guess is we use the result from the reference provider and add models dynamically at that time. I'll post a more elaborate answer here once I'm done with it. In the meantime, have you found the solution?
            – Nishkal Kashyap
            Nov 20 '18 at 4:01










          • not yet. I'm blocked on dev work for the moment to even enable find references for a single file. If I hit it first, I will definitely update on here.
            – Maxm007
            Nov 22 '18 at 11:46


















          • Hi. So I understand monaco.languages.registerReferenceProvider produces the locations for the current model, let's say uri://sourcefile1. Now let's say this file imports a method from from another file uri://sourcefile2 and users does a "Find References" on that method, we know from our SymbolTable that the source location for that method is in uri://sourcefile2. However, Monaco editor isn't aware of this file, so either it needs to be registered with monaco as a model, or there is some hook that we can handle which will load the model.
            – Maxm007
            Nov 18 '18 at 22:28










          • Sorry for the late response. Quite honestly, I'm still working on it this week. But my best guess is we use the result from the reference provider and add models dynamically at that time. I'll post a more elaborate answer here once I'm done with it. In the meantime, have you found the solution?
            – Nishkal Kashyap
            Nov 20 '18 at 4:01










          • not yet. I'm blocked on dev work for the moment to even enable find references for a single file. If I hit it first, I will definitely update on here.
            – Maxm007
            Nov 22 '18 at 11:46
















          Hi. So I understand monaco.languages.registerReferenceProvider produces the locations for the current model, let's say uri://sourcefile1. Now let's say this file imports a method from from another file uri://sourcefile2 and users does a "Find References" on that method, we know from our SymbolTable that the source location for that method is in uri://sourcefile2. However, Monaco editor isn't aware of this file, so either it needs to be registered with monaco as a model, or there is some hook that we can handle which will load the model.
          – Maxm007
          Nov 18 '18 at 22:28




          Hi. So I understand monaco.languages.registerReferenceProvider produces the locations for the current model, let's say uri://sourcefile1. Now let's say this file imports a method from from another file uri://sourcefile2 and users does a "Find References" on that method, we know from our SymbolTable that the source location for that method is in uri://sourcefile2. However, Monaco editor isn't aware of this file, so either it needs to be registered with monaco as a model, or there is some hook that we can handle which will load the model.
          – Maxm007
          Nov 18 '18 at 22:28












          Sorry for the late response. Quite honestly, I'm still working on it this week. But my best guess is we use the result from the reference provider and add models dynamically at that time. I'll post a more elaborate answer here once I'm done with it. In the meantime, have you found the solution?
          – Nishkal Kashyap
          Nov 20 '18 at 4:01




          Sorry for the late response. Quite honestly, I'm still working on it this week. But my best guess is we use the result from the reference provider and add models dynamically at that time. I'll post a more elaborate answer here once I'm done with it. In the meantime, have you found the solution?
          – Nishkal Kashyap
          Nov 20 '18 at 4:01












          not yet. I'm blocked on dev work for the moment to even enable find references for a single file. If I hit it first, I will definitely update on here.
          – Maxm007
          Nov 22 '18 at 11:46




          not yet. I'm blocked on dev work for the moment to even enable find references for a single file. If I hit it first, I will definitely update on here.
          – Maxm007
          Nov 22 '18 at 11:46


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353173%2fshould-i-register-my-entire-source-code-base-as-text-models-in-monaco-editor%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?