microsoft / TypeScript-Sublime-Plugin

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
Apache License 2.0
1.72k stars 237 forks source link

Slow indexing and high CPU #728

Open kresdjan opened 4 years ago

kresdjan commented 4 years ago

The plugin is taking a long time too index and causing Sublime Text to spike the CPU usage.

How can I fix this. I am using the default settings, haven't changed a thing.

MacOS: 10.14.6 Sublime Text: 3.3.2 Plugin version: 3.6.2

willstott101 commented 4 years ago

Currently sublime indexes LOADS of definitions which aren't actually definitions for the tmLanguage syntax definitions which this package uses. More info here: https://github.com/braver/TypeScriptSyntax/issues/3

I would recommend as a quick fix for you personally to disable indexing completely and see if the plugin still works as expected - I presume there is indexing going on in the Typescript language server and the sublime indexing isn't used at all. Set "index_files" to false in the syntax-specific settings.

If this is indeed the case perhaps we can open a Pull Request which makes this happen by default - by deliberately ignoring all typescript scopes from Sublime's indexing engine.

orta commented 4 years ago

I wonder if that would also stop this "go to definition" flickering too

Screen Recording 2020-01-15 at 11 29 12 AM 2020-01-15 11_35_27

Klaster1 commented 4 years ago

@kresdjan I experienced very long indexing too until I updated my user settings with this:

    "index_exclude_patterns":
    [
        "*.log",
        "node_modules/**"
    ],
samelie commented 4 years ago
  "folders": [
  {
    "binary_file_patterns": [
      "*-bundle.js",
      "node_modules/*",
      "bower_components/*",
      "*build/static/js/"
    ],
    "file_exclude_patterns": [
      "*-bundle.js"
    ],
    "index_exclude_patterns": [
      "*.log",
      "node_modules/**",
      "**/node_modules"
    ],
    "folder_exclude_patterns": [
      "node_modules",
      "build/static/js",
      "**/node_modules"
    ],
    "path": "...."
  }]}

Can't be too careful