Skip to content

Commit

Permalink
change word boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
codebykat committed Oct 30, 2020
1 parent c34ec34 commit 8a2ad51
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/note-content-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ class NoteContentEditor extends Component<Props> {
provideCompletionItems(model, position, context, token) {
const line = model.getLineContent(position.lineNumber);
const precedingOpener = line.lastIndexOf('[', position.column);
if (-1 === precedingOpener) {
editor.trigger('completions', 'hideSuggestWidget', null);
return null;
}
const precedingCloser = line.lastIndexOf(']', position.column);
const precedingBracket =
precedingOpener >= 0 && precedingCloser < precedingOpener
Expand Down Expand Up @@ -232,12 +228,6 @@ class NoteContentEditor extends Component<Props> {
...noteTitleAndPreview(note),
}));

if (0 === notes.length) {
// dismiss the widget if we don't have anything to suggest
editor.trigger('completions', 'hideSuggestWidget', null);
return null;
}

const additionalTextEdits =
precedingBracket >= 0
? [
Expand Down Expand Up @@ -776,6 +766,11 @@ class NoteContentEditor extends Component<Props> {
this.completionProvider(this.state.noteId, editor)
);
editor.onDidDispose(() => completionProviderHandle?.dispose());
monaco.languages.setLanguageConfiguration('plaintext', {
// Allow any non-whitespace character to be part of a "word"
// This prevents the dictionary suggestions from taking over our autosuggest
wordPattern: /[^\s]+/g,
});

document.oncopy = (event) => {
// @TODO: This is selecting everything in the app but we should only
Expand Down

0 comments on commit 8a2ad51

Please sign in to comment.