File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ const cp = require("child_process");
22const { shell } = require ( "electron" ) ;
33const { AutoLanguageClient } = require ( "atom-languageclient" ) ;
44
5+ // Ref: https://github.com/nteract/hydrogen/blob/master/lib/autocomplete-provider.js#L33
6+ // adapted from http://stackoverflow.com/q/5474008
7+ const PYTHON_REGEX = / ( [ ^ \d \W ] | [ \u00A0 - \uFFFF ] ) [ \w . \u00A0 - \uFFFF ] * $ / ;
8+
59class PythonLanguageClient extends AutoLanguageClient {
610 getGrammarScopes ( ) {
711 return [ "source.python" ] ;
@@ -40,6 +44,11 @@ class PythonLanguageClient extends AutoLanguageClient {
4044 ) ;
4145 return childProcess ;
4246 }
47+
48+ async getSuggestions ( request ) {
49+ if ( ! PYTHON_REGEX . test ( request . prefix ) ) return null ;
50+ return super . getSuggestions ( request ) ;
51+ }
4352}
4453
4554module . exports = new PythonLanguageClient ( ) ;
You can’t perform that action at this time.
0 commit comments