Autocomplete with non-alphabetic characters not triggering and replacing properly
See original GitHub issueWe are trying to create a kind of namespaced-based autocomplete provider behind the /
prefix. For example, we would want /test
and /foo
to be displayed when the user enters โ/โ in their Monaco editor. There are two issues:
- Simply entering
/
is not triggering the autocomplete In the recording below, I would expect/test
to show up as a suggestion when entering/
, but it wonโt match until/t
is entered. (0:00 - 0:05) - Typing
/t
and confirming the autocomplete choice does not replace the/
prefix. In the recording below, you can see that/test
is replaced by/test test test
, when we want it to betest test test
. (0:06 - 0:10)
Iโve attached a recording below to highlight the issues:
This seems to reproduce with a variety of non-alphabet characters (I also can repro with 1
and .
as a prefix)
monaco-editor version: 0.43.0 Browser: Chrome Playground code that reproduces the issue:
function createDependencyProposals(range) {
// returning a static list of proposals, not even looking at the prefix (filtering is done by the Monaco editor),
// here you could do a server side lookup
return [
{
label: '/test',
kind: monaco.languages.CompletionItemKind.Function,
insertText: 'test test test',
range: range
},
];
}
monaco.languages.registerCompletionItemProvider('javascript', {
provideCompletionItems: function(model, position) {
var word = model.getWordUntilPosition(position);
var range = {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: word.startColumn,
endColumn: word.endColumn
};
console.log(createDependencyProposals(range))
return {
suggestions: createDependencyProposals(range)
};
}
});
monaco.editor.create(document.getElementById("container"), {
value: "",
language: "javascript"
});
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
jQuery UI Autocomplete ignore non alphanumeric letters
You should strip the non alpha-numeric characters from both the input and the term that you're matching. Try calling something like this onย ......
Read more >Auto-completion - Notepad++ User Manual
If you want to include special characters in the retVal or descr attributes and have it render properly in the call tip popup,...
Read more >Accent Folding for Auto-Complete - A List Apart
One byte equaled one character, no exceptions, and you could only load one language's alphabet at a time. This was fine because it...
Read more >Password containing non-alphanumeric characters doesn't work
And to be clear, 1Password does not AutoFill. Rather, 1Password will fill your credentials when you manually select a login. If you're seeing...
Read more >AutoCompleteTextView - Android Developers
android:digits, If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@alan-codaio Try using
triggerCharacters
.I also stumbled over this. For a custom language, I want autocompletion for variables that always begin with
$
(e.g.$foo
). By default, neither filtering works with typing a$
character (the list is not filtered with all variables that begin with$
), nor does accepting the auto-completion work correctly (I end up with$$foo
). An option would be nice to also respect special characters.