Skip to content

Commit

Permalink
Merge pull request #753 from pulsar-edit/autocomplete-html/catch-errors
Browse files Browse the repository at this point in the history
[autocomplete-html] Wrap completions in `try/catch` handler
  • Loading branch information
confused-Techie authored Oct 10, 2023
2 parents 81638a8 + a842fe4 commit 00f19c9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/autocomplete-html/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ const provider = {
filterSuggestions: true,

getSuggestions (request) {
if (request.editor.getBuffer().getLanguageMode().tree) {
return getSuggestionsWithTreeSitter(request)
} else {
return getSuggestionsWithTextMate(request)
try {
if (request.editor.getBuffer().getLanguageMode().tree) {
return getSuggestionsWithTreeSitter(request)
} else {
return getSuggestionsWithTextMate(request)
}
} catch(err) {
// We avoid creating any actual error messages, as this is intended to fix
// the case when providing completions for EJS that multiple continious
// errors are created rapidly.
// https://github.com/pulsar-edit/pulsar/issues/649
console.error(err);
return [];
}
},

Expand Down

0 comments on commit 00f19c9

Please sign in to comment.