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

LSP-file-watcher-chokidar

by sublimelsp ST4 Trending

Chokidar-based file watcher implementation for LSP

Details

Installs

  • Total 6K
  • Win 2K
  • Mac 2K
  • Linux 2K
Mar 2 Mar 1 Feb 29 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17
Windows 0 7 4 4 10 1 5 2 5 7 4 2 1 4 3 3 3 2 6 2 4 4 1 0 7 5 3 6 1 6 3 8 6 3 6 0 2 4 4 1 7 5 2 4 1 1
Mac 0 5 4 5 7 4 2 2 2 5 5 3 3 3 0 1 0 2 5 1 7 4 1 9 4 2 2 5 2 1 3 1 5 1 4 6 1 3 1 2 1 0 0 4 3 4
Linux 0 4 6 4 5 6 4 3 1 7 9 5 0 6 0 4 3 4 2 3 3 2 3 3 3 2 0 3 0 2 3 8 4 0 4 4 4 5 7 6 3 2 1 5 1 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.