monaco-editor
monaco-editor copied to clipboard
[Bug] SQL dialect does not work
Reproducible in vscode.dev or in VS Code Desktop?
- [X] Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- [ ] Not reproducible in the monaco editor playground
Monaco Editor Playground Code
monaco.editor.create(document.getElementById('container'), {
value: "",
language: 'sql'
});
Reproduction Steps
Simply type select * from f
in the playground editor.
Actual (Problematic) Behavior
The editor suggests "from" when you type the "f", which doesn't make sense. "Select" and "from" are not autosuggested.
Expected Behavior
"Select" and "from" should be suggested, and table names (if provided) should be suggested after "from".
Additional Context
No response
The editor suggests "from" when you type the "f", which doesn't make sense.
You can disable it via wordBasedSuggestions: false
"Select" and "from" should be suggested, and table names (if provided) should be suggested after "from".
This can be implemented using a CompletionItemProvider
, it's nothing Monaco has built in
https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-completion-provider-example https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.CompletionItemProvider.html
That makes sense, but shouldn't it work given that the SQL option is available?
The language
option is for syntax highlighting https://microsoft.github.io/monaco-editor/monarch.html
Autocomplete is an entirely separate thing. You can't expect Monaco to ship with autocomplete support for every language and every SQL flavor.
From the website https://microsoft.github.io/monaco-editor/
That makes sense, I guess why is there any autocomplete whatsoever? Wouldn't it be better if it didn't suggest anything?
That makes sense, I guess why is there any autocomplete whatsoever? Wouldn't it be better if it didn't suggest anything?
Depends who you ask. I imagine there are users that like word-based suggestions which is why it is enabled by default.
This is out of scope.