为什么GitHub的Atom自动完成表明从一端截断一个字符的符号?

时间:2016-03-29 13:14:25

标签: autocomplete atom-editor

我不知道为什么/什么时候开始,但我经常会得到一个自动建议我的代码中存在的值,但丢失了最后一个字母。它不是一个案例,它发生了很多。

Screenshot showing two suggestions, getDraftValu and getDraftValue

我正在运行1.6.0版本

这是我的包裹清单:

Built-in Atom packages (89)
├── about@1.3.0
├── archive-view@0.61.0
├── atom-dark-syntax@0.27.0
├── atom-dark-ui@0.51.0
├── atom-light-syntax@0.28.0
├── atom-light-ui@0.43.0
├── autocomplete-atom-api@0.10.0
├── autocomplete-css@0.11.0
├── autocomplete-html@0.7.2
├── autocomplete-plus@2.25.0
├── autocomplete-snippets@1.10.0
├── autoflow@0.27.0
├── autosave@0.23.0
├── background-tips@0.26.0
├── base16-tomorrow-dark-theme@1.1.0
├── base16-tomorrow-light-theme@1.1.1
├── bookmarks@0.38.2
├── bracket-matcher@0.79.0
├── command-palette@0.38.0
├── deprecation-cop@0.54.0
├── dev-live-reload@0.47.0
├── encoding-selector@0.21.0
├── exception-reporting@0.37.0
├── find-and-replace@0.197.4
├── fuzzy-finder@0.94.0
├── git-diff@0.57.0
├── go-to-line@0.30.0
├── grammar-selector@0.48.0
├── image-view@0.56.0
├── incompatible-packages@0.25.0
├── keybinding-resolver@0.33.0
├── language-c@0.51.1
├── language-clojure@0.19.1
├── language-coffee-script@0.46.0
├── language-csharp@0.11.0
├── language-css@0.36.0
├── language-gfm@0.84.0
├── language-git@0.12.1
├── language-go@0.42.0
├── language-html@0.44.0
├── language-hyperlink@0.16.0
├── language-java@0.17.0
├── language-javascript@0.110.0
├── language-json@0.17.4
├── language-less@0.29.0
├── language-make@0.21.0
├── language-mustache@0.13.0
├── language-objective-c@0.15.1
├── language-perl@0.32.0
├── language-php@0.37.0
├── language-property-list@0.8.0
├── language-python@0.43.0
├── language-ruby@0.68.0
├── language-ruby-on-rails@0.25.0
├── language-sass@0.45.0
├── language-shellscript@0.21.0
├── language-source@0.9.0
├── language-sql@0.20.0
├── language-text@0.7.0
├── language-todo@0.27.0
├── language-toml@0.18.0
├── language-xml@0.34.2
├── language-yaml@0.25.1
├── line-ending-selector@0.3.0
├── link@0.31.0
├── markdown-preview@0.157.2
├── metrics@0.53.1
├── notifications@0.62.1
├── one-dark-syntax@1.2.0
├── one-dark-ui@1.1.9
├── one-light-syntax@1.2.0
├── one-light-ui@1.1.9
├── open-on-github@0.41.0
├── package-generator@0.41.0
├── settings-view@0.232.3
├── snippets@1.0.1
├── solarized-dark-syntax@1.0.0
├── solarized-light-syntax@1.0.0
├── spell-check@0.65.0
├── status-bar@0.83.0
├── styleguide@0.45.1
├── symbols-view@0.110.1
├── tabs@0.91.3
├── timecop@0.33.0
├── tree-view@0.203.2
├── update-package-dependencies@0.10.0
├── welcome@0.33.0
├── whitespace@0.32.1
└── wrap-guide@0.38.1

/Users/me/.atom/packages (26)
├── Stylus@1.0.0
├── activate-power-mode@0.4.1
├── atom-beautify@0.28.24
├── atom-jade@0.3.0
├── atom-material-ui@0.8.0
├── auto-indent@0.5.0
├── autoclose-html@0.22.0
├── emmet@2.4.1
├── file-icons@1.6.19
├── git-diff-details@0.20.0
├── highlight-selected@0.11.2
├── idiomatic-dark-syntax@0.1.3
├── language-cjsx@0.3.0
├── language-javascript-jsx@0.3.7
├── linter@1.11.3
├── linter-coffeelint@1.1.2
├── linter-eslint@5.2.6
├── merge-conflicts@1.3.2
├── pigments@0.26.0
├── predawn-ui@1.0.2
├── pretty-json@0.4.1
├── react@0.14.1
├── react-snippets@0.1.4
├── seti-ui@0.8.1
├── spacegray-dark-neue-ui@1.4.0
└── spacegray-dark-ui@0.12.0

1 个答案:

答案 0 :(得分:1)

事实证明这是language-cjsx包中的缺陷。如果您使用 Ctrl Alt I 打开Chrome开发者工具并检查语法所标识的函数名称标记,则会有一个不必要的{{1包含每个函数名的最后一个字符的元素。

我设法通过removing the mapping between one of the capture groups and the grammar class在我的分叉中解决了这个问题。虽然这有效,但VíctorMartínez提供了一个更优雅的解决方案,其中包含了所有最近的变化from the CoffeeScript grammar package

如果您想测试一下,可以按照以下步骤进行测试:

  1. 卸载现有版本的span包。
  2. 将以上两个language-cjsx分叉中的一个克隆到已知目录。
  3. 运行language-cjsx以将程序包符号链接到Atom的程序包目录。
  4. 使用 Ctrl Alt R 重新启动Atom。
  5. 最终注释:VíctorMartínezhas subsequently noted他目前正在使用orktes/atom-react获取基于CJSX的解决方案的语法高亮显示。