ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

LSP-file-watcher-chokidar

by sublimelsp ST4

Chokidar-based file watcher implementation for LSP

Details

Installs

  • Total 8K
  • Win 3K
  • Mac 2K
  • Linux 3K
Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6
Windows 0 6 1 6 3 5 3 2 3 3 4 4 1 4 5 3 6 3 2 3 4 1 2 3 0 0 0 0 2 3 3 1 1 3 2 1 2 0 0 1 6 3 4 3 3 1
Mac 4 2 7 2 5 1 4 4 4 4 1 0 4 5 5 4 3 3 0 1 5 0 1 1 0 0 0 0 3 5 2 3 0 1 4 2 5 0 0 0 6 2 3 4 2 4
Linux 2 3 1 0 4 2 7 6 0 3 3 0 2 1 2 3 8 2 3 7 4 1 1 1 0 0 0 0 0 2 1 1 1 0 2 1 1 0 0 2 6 12 2 3 2 2

Readme

Source
raw.​githubusercontent.​com

LSP-file-watcher-chokidar

A non-native file watcher implementation for LSP that enables support for the workspace/didChangeWatchedFiles LSP notification.

Installation

  • Install LSP-file-watcher-chokidar from Package Control
  • Restart Sublime.

Usage

Having this package installed alongside LSP enables the workspace.didChangeWatchedFiles capability and support for the workspace/didChangeWatchedFiles notification. The servers can also dynamically register file watchers.

For LSP-* packages that are within the sublimelsp organization it should be enough to just install this package and file watching should work without any extra configuration.

In other cases, it might “just work” (if the server registers watchers dynamically) or it might require manual configuration using the the file_watcher object on the Client configuration object.

file_watcher object properties:

Name Optional Description
patterns No An array of glob patterns defining which files within the workspace should be watched. The patterns are relative to the workspace root. Example: ["{**/*.js,**/*.ts,**/*.json}"]. See also supported pattern syntax.
events Yes An array with the type of events to watch. Default: ["create", "change", "delete"] (all supported types).
ignores Yes An array of glob exclude patterns. By default this includes patterns from Sublime Text's folder_exclude_patterns and file_exclude_patterns settings and additionally the '**/node_modules/**' pattern. When overriding this option the defaults are not included anymore.

Implementation

Registering a watcher creates a new Node process behind the scenes. The current implementation creates at most one process for any number of registrations (even through different language servers).

The reason that this is implemented as a separate package, and not natively within the LSP package, is that this relies on a separate process that does the file watching and for the built-in implementation we would like to use a native API provided by Sublime Text that it doesn't provide at the moment. See the LSP issue #892 for supporting it natively within the LSP package.