microsoft / monaco-editor

A browser based code editor
https://microsoft.github.io/monaco-editor/
MIT License
40.43k stars 3.6k forks source link

Allow changing the wordBasedSuggestions via configuration service #1498

Open liviuu opened 5 years ago

liviuu commented 5 years ago

monaco-editor version: 0.17.0 Browser: Chrome OS: Windows 10 monaco editor with custom added typescript definition files. for language = javascript Intellisense shows all words ignoring the wordBasedSuggesions setting.

var mEditor = monaco.editor.create(document.getElementById(editorId), {
                    value: '',
                    language: 'javascript',
                    automaticLayout: true,
                    scrollBeyondLastLine: false,
                    wordBasedSuggestions: false
                });
mEditor.setModel(null);
//@ts-ignore
var model = monaco.editor.createModel('', 'javascript', filename);
mEditor.setModel(model);

See below. Clearly all symbols except ArrayUtils ( provided by a d.ts ) are not fit as a property of variable a.

image

spahnke commented 5 years ago

Sorry for asking a completely unrelated question, but are those library types static as in

declare function importLibrary('Foo'): FooType;

or are they dynamic as in you generate typings on the fly for the code inside the library? If it is the latter, would you mind giving a short summary of how you accomplish that? We have a scenario where the code inside the library is user-defined, so we cannot know the types in advance, nor can we analyze them before deploying our application.

Thanks in advance! 🙇

stanchovy commented 5 years ago

For the record on the latest build, wordBasedSuggestions does indeed work for custom languages. It does still not work for language=javascript.

alexdima commented 4 years ago

AFAICT wordBasedSuggestions is read from the configuration service directly, it does not get read through editor options here -- https://github.com/microsoft/vscode/blob/68db7fc3f79e4fa8438343d9040d6b8aff6020d1/src/vs/editor/common/services/editorWorkerServiceImpl.ts#L148.