question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to scope the editor models / `typescriptDefaults`

See original GitHub issue

I’ve tried it at StackOverflow, but had no luck…

Any chance advise to scope the changes to monaco.languages.typescript or the “editor models”.

Background: I want to host multiple Monaco editors with different sets of models (maybe also different typescriptDefaults).

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
alexdimacommented, Nov 13, 2018

Is what you mean with the “ts2” language a “fake” language without semantic model, but just a syntax highlighting enabled editor

Yes

And when changing the focus between the editors, I also need to switch the global editor models (dispose all, and create them for the focused editor).

No, I think you just need to implement the following:

editors.forEach(function(editor) {
	editor.onDidBlurEditorWidget(() => {
        monaco.editor.setModelLanguage(editor.getModel(), 'ts2')
    });
    editor.onDidFocusEditorWidget(() => {
        monaco.editor.setModelLanguage(editor.getModel(), 'typescript')
    });
});

I’m not sure how well it’s gonna work, but this is the cheapest I can think of to simulate something similar to what you describe.

1reaction
thedanielhankecommented, Feb 22, 2022

Any news on this topic?

Read more comments on GitHub >

github_iconTop Results From Across the Web

LanguageServiceDefaults | Monaco Editor API
Configure if all existing models should be eagerly sync'd to the worker on start or restart. Parameters. value: boolean. Returns void. setExtraLibs.
Read more >
monaco-editor | Yarn - Package Manager
Learn how to use the editor API and try out your own customizations in the playground. Explore the API docs or read them...
Read more >
https://unpkg.com/monaco-editor@0.5.3/monaco.d.ts
IDiffNavigatorOptions): IDiffNavigator; /** * Create a new editor model. * You can specify the language that should be set for this model or...
Read more >
Source - GitHub
onlyVisible` for TypeScript which limits the computation of diagnostics to only visible text models. - fixed issue where the editor would not load...
Read more >
Chelsea Finn on Twitter: "We find that SERAC can edit ...
SERAC is a new model editor that can: * update factual info * selectively change ... struggle to make precise edits on hard...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found