pichillilorenzo / JavaScriptEnhancements

JavaScript Enhancements is a plugin for Sublime Text 3. It offers not only a smart javascript autocomplete but also a lot of features about creating, developing and managing javascript projects (real-time errors, code refactoring, etc.).
MIT License
639 stars 41 forks source link

Autocompletion does not work on files with non-latin chars #54

Closed r13s closed 6 years ago

r13s commented 6 years ago

Expected Behavior

Autocompletion should work in all js-files.

Actual Behavior

After opening gulpfile.js, the autocompletion does not work in this and any other js-files until the Sublime Text is restarted.

Sublime Text console logs

DPI mode: per-monitor v2
startup, version: 3170 windows x64 channel: stable
executable: /D/Portables/SublimeText/sublime_text.exe
working dir: /D/Portables/SublimeText
packages path: /D/Portables/SublimeText/Data/Packages
state path: /D/Portables/SublimeText/Data/Local
zip path: /D/Portables/SublimeText/Packages
zip path: /D/Portables/SublimeText/Data/Installed Packages
ignored_packages: ["Vintage"]
Errors parsing theme:
icon_file_type is missing layer0.opacity, setting to 1.0 for backwards compatibility
icon_file_type is missing layer0.opacity, setting to 1.0 for backwards compatibility
pre session restore time: 0.218899
loading dictionary Packages/Language - English/en_US.dic
startup time: 0.359899
first paint time: 0.359899
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.50-requests
reloading plugin 0_package_control_loader.55-jsonschema
reloading plugin A File Icon.A File Icon
reloading plugin AdvancedNewFile.AdvancedNewFile
reloading plugin AutoFileName.autofilename
reloading plugin AutoFileName.getimageinfo
reloading plugin ayu.activation
reloading plugin ayu.Icons
reloading plugin Color Highlighter.color_converter
reloading plugin Color Highlighter.color_highlighter
reloading plugin Color Highlighter.color_hover_listener
reloading plugin Color Highlighter.color_scheme
reloading plugin Color Highlighter.color_scheme_color_highlighter
reloading plugin Color Highlighter.color_searcher
reloading plugin Color Highlighter.color_selection_listener
reloading plugin Color Highlighter.colors
reloading plugin Color Highlighter.content_listener
reloading plugin Color Highlighter.convert_color_command
reloading plugin Color Highlighter.css_colors
reloading plugin Color Highlighter.dummy_event_listener
reloading plugin Color Highlighter.gutter_icons_color_highlighter
reloading plugin Color Highlighter.load_resource
reloading plugin Color Highlighter.main
reloading plugin Color Highlighter.path
reloading plugin Color Highlighter.phantoms_color_highlighter
reloading plugin Color Highlighter.pick_color_command
reloading plugin Color Highlighter.regex_compiler
reloading plugin Color Highlighter.regions
reloading plugin Color Highlighter.set_setting_command
reloading plugin Color Highlighter.settings
reloading plugin Color Highlighter.st_helper
reloading plugin Color Highlighter.topsort
reloading plugin Emmet.emmet-plugin
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin SublimeLinter-contrib-htmlhint.linter
htmlhint: Defining 'cls.syntax' has been deprecated. Use http://www.sublimelinter.com/en/stable/linter_settings.html#selector
reloading plugin SublimeLinter-eslint.linter
reloading plugin SublimeLinter-stylelint.linter
reloading plugin SublimeLinter.__init__
reloading plugin SublimeLinter.active_linters_view
reloading plugin SublimeLinter.busy_indicator_view
reloading plugin SublimeLinter.goto_commands
reloading plugin SublimeLinter.highlight_view
reloading plugin SublimeLinter.log_handler
reloading plugin SublimeLinter.message_view
reloading plugin SublimeLinter.panel_view
reloading plugin SublimeLinter.status_bar_view
reloading plugin SublimeLinter.sublime_linter
reloading plugin Sync Settings.SyncSettings
reloading plugin JavaScript Enhancements.main
reloading plugin JsPrettier.JsPrettier
plugins loaded
environ({'COMMONPROGRAMFILES(X86)': 'C:\\Program Files (x86)\\Common Files', 'USERPROFILE': 'C:\\Users\\dr13s', 'PROGRAMFILES': 'C:\\Program Files', 'PATH': 'C:\\Python36\\Scripts\\;C:\\Python36\\;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Ruby25-x64\\bin;C:\\Users\\dr13s\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\MKVToolNix;C:\\Users\\dr13s\\AppData\\Roaming\\npm;D:\\Portables\\aria2c;D:\\lib\\ffmpeg\\ffmpeg-latest-win64-static\\bin;D:\\lib\\AtomicParsley;C:\\Program Files\\Microsoft VS Code\\bin;D:\\Portables\\mpv;C:\\Users\\dr13s\\AppData\\Roaming\\Pub\\Cache\\bin;D:\\Portables\\SublimeText;D:\\lib\\html_tidy;', 'FPS_BROWSER_USER_PROFILE_STRING': 'Default', 'CHOCOLATEYINSTALL': 'C:\\ProgramData\\chocolatey', 'TEMP': 'C:\\Users\\dr13s\\AppData\\Local\\Temp', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.RB;.RBW', 'USERDOMAIN_ROAMINGPROFILE': 'DESKTOP-7K4GB50', 'SYSTEMDRIVE': 'C:', 'DRIVERDATA': 'C:\\Windows\\System32\\Drivers\\DriverData', 'LOCALAPPDATA': 'C:\\Users\\dr13s\\AppData\\Local', 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel', 'PROGRAMDATA': 'C:\\ProgramData', 'NUMBER_OF_PROCESSORS': '4', 'COMPUTERNAME': 'DESKTOP-7K4GB50', 'HOMEDRIVE': 'C:', 'SYSTEMROOT': 'C:\\WINDOWS', 'ONEDRIVE': 'F:\\OneDrive', 'USERDOMAIN': 'DESKTOP-7K4GB50', 'PROCESSOR_LEVEL': '6', 'PUBLIC': 'C:\\Users\\Public', 'PROGRAMW6432': 'C:\\Program Files', 'PROGRAMFILES(X86)': 'C:\\Program Files (x86)', 'USERNAME': 'dr13s', 'PROCESSOR_ARCHITECTURE': 'AMD64', 'ALLUSERSPROFILE': 'C:\\ProgramData', 'PROCESSOR_REVISION': '3c03', 'HOMEPATH': '\\Users\\dr13s', 'COMSPEC': 'C:\\WINDOWS\\system32\\cmd.exe', 'CHOCOLATEYTOOLSLOCATION': 'C:\\tools', 'OS': 'Windows_NT', 'SESSIONNAME': 'Console', 'COMMONPROGRAMW6432': 'C:\\Program Files\\Common Files', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'FPS_BROWSER_APP_PROFILE_STRING': 'Internet Explorer', 'PSMODULEPATH': 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Intel\\Wired Networking\\', 'LOGONSERVER': '\\\\DESKTOP-7K4GB50', 'TMP': 'C:\\Users\\dr13s\\AppData\\Local\\Temp', 'WINDIR': 'C:\\WINDOWS', 'APPDATA': 'C:\\Users\\dr13s\\AppData\\Roaming', 'CHOCOLATEYLASTPATHUPDATE': 'Sun May  6 16:34:15 2018'})
Emmet: No need to update PyV8
JavaScript Enhancements plugin version: 0.16.15
['node', '-v']
node.js version: v8.11.1
['node', '-v']
['npm', '-v']
npm version: 6.0.1
Package Control: Skipping automatic upgrade, last run at 2018-05-13 16:34:14, next run at 2018-05-13 17:34:14 or after
starting flow ide server: ['D:\\Portables\\SublimeText\\Data\\Packages\\JavaScript Enhancements\\node_modules\\.bin\\flow.cmd', 'ide', '--protocol', 'very-unstable', '--from', 'sublime_text', '--root', 'D:\\Portables\\SublimeText\\Data\\Packages\\JavaScript Enhancements\\src\\libs\\flow']
"D:\\Portables\\SublimeText\\Data\\Packages\\JavaScript Enhancements\\node_modules\\.bin\\flow.cmd" "ast" "--from" "sublime_text" < "c:\\users\\dr13s\\appdata\\local\\temp\\javascript_enhancements_vesm7s"

Screenshots

sublime

Steps to Reproduce the Problem

  1. Start Sublime Text, open and / or create any js-file, except gulpfile.js - autocomplete works.
  2. Open gulpfile.js - autocompletion no longer works for any js-files until Sublime Text is restarted.

Specifications

Gulpfile:

gulpfile.zip

pichillilorenzo commented 6 years ago

Hi @bezdupel, I have analyzed your gulpfile.js and there is an unrecognized character that makes Flow server crash (I think because there is an hidden special char or something similar)!

The line 60 is the line that causes the server crash:

    maxWidth: '1200px' /* max-width on very large screen */,

and the character is the letter o of the on word in your comment. Just delete and rewrite it πŸ‘

r13s commented 6 years ago

Oh, thanks, it helped. I copied this line from the official documentation :smile:

But do not you think it's a bug that the wrong letter in the comment leads to the inoperability of the extension?

I do not really want to switch to VSCode, for example, but there autocompletion does not pay attention to the wrong letters in the comments.

Is there any way to correct this behavior in your extension? Or at least specify in the console where exactly to search for the wrong letter or symbol?

r13s commented 6 years ago

After all, comments can contain, for example, cyrillic symbols or hieroglyphs, etc.

By the way, Java Script Completions does not pay attention to the "wrong" characters πŸ˜‰

pichillilorenzo commented 6 years ago

It isn't a bug of the extension. Instead, it is a bug of Flow. The flow server is the one that can't recognize it. In fact, it throws this error:

Unhandled exception: Invalid_argument("Char.chr")
Raised at file "pervasives.ml", line 33, characters 20-45
Called from file "hack/utils/hh_json/hh_json.ml", line 167, characters 12-25
Called from file "hack/utils/hh_json/hh_json.ml", line 183, characters 14-22
Called from file "hack/utils/hh_json/hh_json.ml", line 268, characters 12-24
Called from file "hack/utils/hh_json/hh_json.ml", line 287, characters 14-25
Called from file "hack/utils/hh_json/hh_json.ml", line 295, characters 10-22
Called from file "hack/utils/hh_json/hh_json.ml", line 243, characters 12-23
Called from file "hack/utils/hh_json/hh_json.ml", line 262, characters 14-21

Also, I can't delete comments because Flow could use them, for example for linting or for defining types in your code. I'm really sorry about this! I hope the Facebook team will fix it as soon as possible.

About the "JavaScript Completions" plugin, because it works in a different way. It doesn't take into account the current context. It is just a static list of completions.. I mean that it won't produce smart completions! Flow instead analyzes the code and return a list of possible completions, looking also in other files and in your defined functions/classes/variables. It is much better!

r13s commented 6 years ago

Thanks, now everything is clear.

Perhaps it's worth pointing somewhere in the wiki about this behavior - about the (temporary?) inadmissibility of non-latin characters in the code?

And thanks again for your work and excellent extension πŸ‘

pichillilorenzo commented 6 years ago

Ok, I was wrong! There are problems when I send data to the flow server with this non-latin chars. I will try to resolve this!

pichillilorenzo commented 6 years ago

Solved! I'm going to publish a new release with this fix. Thanks a lot @bezdupel

r13s commented 6 years ago

I'm glad I could help you! πŸ‘