diff --git a/Cargo.toml b/Cargo.toml index 95830561d291..4a8c23453841 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,6 @@ members = [ "crates/*" ] [profile.release] incremental = true debug = true + +[patch.crates-io] +languageserver-types = {path="../languageserver-types"} diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index a1d462528d60..910c76170916 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -268,6 +268,16 @@ impl Analysis { pub fn extend_selection(&self, file: &SourceFileNode, range: TextRange) -> TextRange { ra_editor::extend_selection(file, range).unwrap_or(range) } + pub fn selection_ranges(&self, position: FilePosition) -> Vec { + let file = self.file_syntax(position.file_id); + let mut res = Vec::new(); + let mut range = TextRange::offset_len(position.offset, 0.into()); + while let Some(r) = ra_editor::extend_selection(&file, range) { + res.push(r); + range = r; + } + res + } pub fn matching_brace(&self, file: &SourceFileNode, offset: TextUnit) -> Option { ra_editor::matching_brace(file, offset) } diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs index 560f64989509..1a04b573c137 100644 --- a/crates/ra_lsp_server/src/caps.rs +++ b/crates/ra_lsp_server/src/caps.rs @@ -40,6 +40,7 @@ pub fn server_capabilities() -> ServerCapabilities { more_trigger_character: None, }), folding_range_provider: Some(FoldingRangeProviderCapability::Simple(true)), + selection_range_provider: Some(true), rename_provider: Some(RenameProviderCapability::Options(RenameOptions { prepare_provider: Some(true), })), diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 1d6e3e5d609d..a2f6b6458082 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -250,6 +250,7 @@ fn on_request( .on::(handlers::handle_completion)? .on::(handlers::handle_code_action)? .on::(handlers::handle_folding_range)? + .on::(handlers::handle_selection_range)? .on::(handlers::handle_signature_help)? .on::(handlers::handle_hover)? .on::(handlers::handle_prepare_rename)? diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 801966304cf5..88b2ecf02ef7 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -45,6 +45,22 @@ pub fn handle_extend_selection( Ok(req::ExtendSelectionResult { selections }) } +pub fn handle_selection_range( + world: ServerWorld, + params: req::TextDocumentPositionParams, +) -> Result> { + let position = params.try_conv_with(&world)?; + let line_index = world.analysis().file_line_index(position.file_id); + let ranges = world + .analysis() + .selection_ranges(position) + .into_iter() + .map_conv_with(&line_index) + .map(|range| req::SelectionRange { range }) + .collect(); + Ok(ranges) +} + pub fn handle_find_matching_brace( world: ServerWorld, params: req::FindMatchingBraceParams, diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs index 999792ecba8e..4984c35ca613 100644 --- a/crates/ra_lsp_server/src/req.rs +++ b/crates/ra_lsp_server/src/req.rs @@ -46,6 +46,20 @@ pub struct ExtendSelectionResult { pub selections: Vec, } +pub enum SelectionRangeRequest {} + +impl Request for SelectionRangeRequest { + type Params = TextDocumentPositionParams; + type Result = Vec; + const METHOD: &'static str = "textDocument/selectionRange"; +} + +#[derive(Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct SelectionRange { + pub range: Range, +} + pub enum FindMatchingBrace {} impl Request for FindMatchingBrace { diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index 5e3d64eef2fd..9ce952fa58bd 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json @@ -1935,7 +1935,8 @@ "semver": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true }, "source-map": { "version": "0.6.1", @@ -2535,34 +2536,1627 @@ "vinyl-source-stream": "1.1.2" } }, - "vscode-jsonrpc": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz", - "integrity": "sha512-perEnXQdQOJMTDFNv+UF3h1Y0z4iSiaN9jIlb0OqIYgosPCZGYh/MCUlkFtV2668PL69lRDO32hmvL2yiidUYg==" - }, "vscode-languageclient": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.2.1.tgz", - "integrity": "sha512-7jrS/9WnV0ruqPamN1nE7qCxn0phkH5LjSgSp9h6qoJGoeAKzwKz/PF6M+iGA/aklx4GLZg1prddhEPQtuXI1Q==", + "version": "file:../../../vscode-languageserver-node/client", "requires": { - "semver": "5.6.0", + "semver": "5.5.0", "vscode-languageserver-protocol": "3.14.1" + }, + "dependencies": { + "@types/semver": { + "version": "5.5.0", + "bundled": true + }, + "ajv": { + "version": "5.5.2", + "bundled": true, + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "ansi-cyan": { + "version": "0.1.1", + "bundled": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-red": { + "version": "0.1.1", + "bundled": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-wrap": { + "version": "0.1.0", + "bundled": true + }, + "arr-diff": { + "version": "1.1.0", + "bundled": true, + "requires": { + "arr-flatten": "1.1.0", + "array-slice": "0.2.3" + } + }, + "arr-flatten": { + "version": "1.1.0", + "bundled": true + }, + "arr-union": { + "version": "2.1.0", + "bundled": true + }, + "array-differ": { + "version": "1.0.0", + "bundled": true + }, + "array-slice": { + "version": "0.2.3", + "bundled": true + }, + "array-union": { + "version": "1.0.2", + "bundled": true, + "requires": { + "array-uniq": "1.0.3" + } + }, + "array-uniq": { + "version": "1.0.3", + "bundled": true + }, + "array-unique": { + "version": "0.2.1", + "bundled": true + }, + "arrify": { + "version": "1.0.1", + "bundled": true + }, + "asn1": { + "version": "0.2.3", + "bundled": true + }, + "assert-plus": { + "version": "1.0.0", + "bundled": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true + }, + "aws-sign2": { + "version": "0.7.0", + "bundled": true + }, + "aws4": { + "version": "1.7.0", + "bundled": true + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "bundled": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "requires": { + "inherits": "2.0.3" + } + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "bundled": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } + }, + "browser-stdout": { + "version": "1.3.0", + "bundled": true + }, + "buffer-crc32": { + "version": "0.2.13", + "bundled": true + }, + "buffer-from": { + "version": "1.1.0", + "bundled": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true + }, + "clone": { + "version": "0.2.0", + "bundled": true + }, + "clone-buffer": { + "version": "1.0.0", + "bundled": true + }, + "clone-stats": { + "version": "0.0.1", + "bundled": true + }, + "cloneable-readable": { + "version": "1.1.2", + "bundled": true, + "requires": { + "inherits": "2.0.3", + "process-nextick-args": "2.0.0", + "readable-stream": "2.3.6" + } + }, + "co": { + "version": "4.6.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.6", + "bundled": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.11.0", + "bundled": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "convert-source-map": { + "version": "1.5.1", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "debug": { + "version": "3.1.0", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-assign": { + "version": "1.0.0", + "bundled": true, + "requires": { + "is-obj": "1.0.1" + } + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "diff": { + "version": "3.3.1", + "bundled": true + }, + "duplexer": { + "version": "0.1.1", + "bundled": true + }, + "duplexify": { + "version": "3.6.0", + "bundled": true, + "requires": { + "end-of-stream": "1.4.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "stream-shift": "1.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "end-of-stream": { + "version": "1.4.1", + "bundled": true, + "requires": { + "once": "1.4.0" + } + }, + "es6-object-assign": { + "version": "1.1.0", + "bundled": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "bundled": true + }, + "event-stream": { + "version": "3.3.4", + "bundled": true, + "requires": { + "duplexer": "0.1.1", + "from": "0.1.7", + "map-stream": "0.1.0", + "pause-stream": "0.0.11", + "split": "0.3.3", + "stream-combiner": "0.0.4", + "through": "2.3.8" + } + }, + "expand-brackets": { + "version": "0.1.5", + "bundled": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "bundled": true, + "requires": { + "fill-range": "2.2.4" + } + }, + "extend": { + "version": "3.0.1", + "bundled": true + }, + "extend-shallow": { + "version": "1.1.4", + "bundled": true, + "requires": { + "kind-of": "1.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "bundled": true, + "requires": { + "is-extglob": "1.0.0" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "bundled": true + } + } + }, + "extsprintf": { + "version": "1.3.0", + "bundled": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "bundled": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "bundled": true + }, + "fd-slicer": { + "version": "1.1.0", + "bundled": true, + "requires": { + "pend": "1.2.0" + } + }, + "filename-regex": { + "version": "2.0.1", + "bundled": true + }, + "fill-range": { + "version": "2.2.4", + "bundled": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "3.0.0", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, + "first-chunk-stream": { + "version": "1.0.0", + "bundled": true + }, + "for-in": { + "version": "1.0.2", + "bundled": true + }, + "for-own": { + "version": "0.1.5", + "bundled": true, + "requires": { + "for-in": "1.0.2" + } + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true + }, + "form-data": { + "version": "2.3.2", + "bundled": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" + } + }, + "from": { + "version": "0.1.7", + "bundled": true + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true + }, + "fstream": { + "version": "1.0.11", + "bundled": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.2" + } + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-base": { + "version": "0.3.0", + "bundled": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + }, + "dependencies": { + "glob-parent": { + "version": "2.0.0", + "bundled": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "is-extglob": { + "version": "1.0.0", + "bundled": true + }, + "is-glob": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extglob": "1.0.0" + } + } + } + }, + "glob-parent": { + "version": "3.1.0", + "bundled": true, + "requires": { + "is-glob": "3.1.0", + "path-dirname": "1.0.2" + } + }, + "glob-stream": { + "version": "5.3.5", + "bundled": true, + "requires": { + "extend": "3.0.1", + "glob": "5.0.15", + "glob-parent": "3.1.0", + "micromatch": "2.3.11", + "ordered-read-streams": "0.3.0", + "through2": "0.6.5", + "to-absolute-glob": "0.1.1", + "unique-stream": "2.2.1" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "bundled": true, + "requires": { + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "isarray": { + "version": "0.0.1", + "bundled": true + }, + "readable-stream": { + "version": "1.0.34", + "bundled": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true + }, + "through2": { + "version": "0.6.5", + "bundled": true, + "requires": { + "readable-stream": "1.0.34", + "xtend": "4.0.1" + } + } + } + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true + }, + "growl": { + "version": "1.10.3", + "bundled": true + }, + "gulp-chmod": { + "version": "2.0.0", + "bundled": true, + "requires": { + "deep-assign": "1.0.0", + "stat-mode": "0.2.2", + "through2": "2.0.3" + } + }, + "gulp-filter": { + "version": "5.1.0", + "bundled": true, + "requires": { + "multimatch": "2.1.0", + "plugin-error": "0.1.2", + "streamfilter": "1.0.7" + } + }, + "gulp-gunzip": { + "version": "1.0.0", + "bundled": true, + "requires": { + "through2": "0.6.5", + "vinyl": "0.4.6" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "bundled": true + }, + "readable-stream": { + "version": "1.0.34", + "bundled": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "string_decoder": { + "version": "0.10.31", + "bundled": true + }, + "through2": { + "version": "0.6.5", + "bundled": true, + "requires": { + "readable-stream": "1.0.34", + "xtend": "4.0.1" + } + } + } + }, + "gulp-remote-src-vscode": { + "version": "0.5.0", + "bundled": true, + "requires": { + "event-stream": "3.3.4", + "node.extend": "1.1.6", + "request": "2.87.0", + "through2": "2.0.3", + "vinyl": "2.2.0" + }, + "dependencies": { + "clone": { + "version": "2.1.1", + "bundled": true + }, + "clone-stats": { + "version": "1.0.0", + "bundled": true + }, + "vinyl": { + "version": "2.2.0", + "bundled": true, + "requires": { + "clone": "2.1.1", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" + } + } + } + }, + "gulp-sourcemaps": { + "version": "1.6.0", + "bundled": true, + "requires": { + "convert-source-map": "1.5.1", + "graceful-fs": "4.1.11", + "strip-bom": "2.0.0", + "through2": "2.0.3", + "vinyl": "1.2.0" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "bundled": true + }, + "replace-ext": { + "version": "0.0.1", + "bundled": true + }, + "vinyl": { + "version": "1.2.0", + "bundled": true, + "requires": { + "clone": "1.0.4", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + } + } + } + }, + "gulp-symdest": { + "version": "1.1.0", + "bundled": true, + "requires": { + "event-stream": "3.3.4", + "mkdirp": "0.5.1", + "queue": "3.1.0", + "vinyl-fs": "2.4.4" + } + }, + "gulp-untar": { + "version": "0.0.7", + "bundled": true, + "requires": { + "event-stream": "3.3.4", + "streamifier": "0.1.1", + "tar": "2.2.1", + "through2": "2.0.3", + "vinyl": "1.2.0" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "bundled": true + }, + "replace-ext": { + "version": "0.0.1", + "bundled": true + }, + "vinyl": { + "version": "1.2.0", + "bundled": true, + "requires": { + "clone": "1.0.4", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + } + } + } + }, + "gulp-vinyl-zip": { + "version": "2.1.0", + "bundled": true, + "requires": { + "event-stream": "3.3.4", + "queue": "4.4.2", + "through2": "2.0.3", + "vinyl": "2.2.0", + "vinyl-fs": "2.4.4", + "yauzl": "2.9.2", + "yazl": "2.4.3" + }, + "dependencies": { + "clone": { + "version": "2.1.1", + "bundled": true + }, + "clone-stats": { + "version": "1.0.0", + "bundled": true + }, + "queue": { + "version": "4.4.2", + "bundled": true, + "requires": { + "inherits": "2.0.3" + } + }, + "vinyl": { + "version": "2.2.0", + "bundled": true, + "requires": { + "clone": "2.1.1", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" + } + } + } + }, + "har-schema": { + "version": "2.0.0", + "bundled": true + }, + "har-validator": { + "version": "5.0.3", + "bundled": true, + "requires": { + "ajv": "5.5.2", + "har-schema": "2.0.0" + } + }, + "has-flag": { + "version": "2.0.0", + "bundled": true + }, + "he": { + "version": "1.1.1", + "bundled": true + }, + "http-signature": { + "version": "1.2.0", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.14.2" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "interpret": { + "version": "1.1.0", + "bundled": true + }, + "is": { + "version": "3.2.1", + "bundled": true + }, + "is-buffer": { + "version": "1.1.6", + "bundled": true + }, + "is-dotfile": { + "version": "1.0.3", + "bundled": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "bundled": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "bundled": true + }, + "is-extglob": { + "version": "2.1.1", + "bundled": true + }, + "is-glob": { + "version": "3.1.0", + "bundled": true, + "requires": { + "is-extglob": "2.1.1" + } + }, + "is-number": { + "version": "2.1.0", + "bundled": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "bundled": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "bundled": true + }, + "is-posix-bracket": { + "version": "0.1.1", + "bundled": true + }, + "is-primitive": { + "version": "2.0.0", + "bundled": true + }, + "is-stream": { + "version": "1.1.0", + "bundled": true + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true + }, + "is-utf8": { + "version": "0.2.1", + "bundled": true + }, + "is-valid-glob": { + "version": "0.3.0", + "bundled": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "isobject": { + "version": "2.1.0", + "bundled": true, + "requires": { + "isarray": "1.0.0" + } + }, + "isstream": { + "version": "0.1.2", + "bundled": true + }, + "jsbn": { + "version": "0.1.1", + "bundled": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "bundled": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true + }, + "jsonify": { + "version": "0.0.0", + "bundled": true + }, + "jsprim": { + "version": "1.4.1", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "1.1.0", + "bundled": true + }, + "lazystream": { + "version": "1.0.0", + "bundled": true, + "requires": { + "readable-stream": "2.3.6" + } + }, + "lodash.isequal": { + "version": "4.5.0", + "bundled": true + }, + "map-stream": { + "version": "0.1.0", + "bundled": true + }, + "math-random": { + "version": "1.0.1", + "bundled": true + }, + "merge-stream": { + "version": "1.0.1", + "bundled": true, + "requires": { + "readable-stream": "2.3.6" + } + }, + "micromatch": { + "version": "2.3.11", + "bundled": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + }, + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "bundled": true, + "requires": { + "arr-flatten": "1.1.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "bundled": true + }, + "is-glob": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "bundled": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "mime-db": { + "version": "1.33.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.18", + "bundled": true, + "requires": { + "mime-db": "1.33.0" + } + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "1.2.0", + "bundled": true + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "bundled": true + } + } + }, + "mocha": { + "version": "4.1.0", + "bundled": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true + }, + "multimatch": { + "version": "2.1.0", + "bundled": true, + "requires": { + "array-differ": "1.0.0", + "array-union": "1.0.2", + "arrify": "1.0.1", + "minimatch": "3.0.4" + } + }, + "node.extend": { + "version": "1.1.6", + "bundled": true, + "requires": { + "is": "3.2.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "bundled": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "object.omit": { + "version": "2.0.1", + "bundled": true, + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "ordered-read-streams": { + "version": "0.3.0", + "bundled": true, + "requires": { + "is-stream": "1.1.0", + "readable-stream": "2.3.6" + } + }, + "parse-glob": { + "version": "3.0.4", + "bundled": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "bundled": true + }, + "is-glob": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extglob": "1.0.0" + } + } + } + }, + "path-dirname": { + "version": "1.0.2", + "bundled": true + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true + }, + "path-parse": { + "version": "1.0.5", + "bundled": true + }, + "pause-stream": { + "version": "0.0.11", + "bundled": true, + "requires": { + "through": "2.3.8" + } + }, + "pend": { + "version": "1.2.0", + "bundled": true + }, + "performance-now": { + "version": "2.1.0", + "bundled": true + }, + "plugin-error": { + "version": "0.1.2", + "bundled": true, + "requires": { + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" + } + }, + "preserve": { + "version": "0.2.0", + "bundled": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.5.2", + "bundled": true + }, + "querystringify": { + "version": "2.0.0", + "bundled": true + }, + "queue": { + "version": "3.1.0", + "bundled": true, + "requires": { + "inherits": "2.0.3" + } + }, + "randomatic": { + "version": "3.0.0", + "bundled": true, + "requires": { + "is-number": "4.0.0", + "kind-of": "6.0.2", + "math-random": "1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "bundled": true + }, + "kind-of": { + "version": "6.0.2", + "bundled": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "rechoir": { + "version": "0.6.2", + "bundled": true, + "requires": { + "resolve": "1.8.1" + } + }, + "regex-cache": { + "version": "0.4.4", + "bundled": true, + "requires": { + "is-equal-shallow": "0.1.3" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "bundled": true + }, + "repeat-element": { + "version": "1.1.2", + "bundled": true + }, + "repeat-string": { + "version": "1.6.1", + "bundled": true + }, + "replace-ext": { + "version": "1.0.0", + "bundled": true + }, + "request": { + "version": "2.87.0", + "bundled": true, + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.7.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.2", + "safe-buffer": "5.1.2", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.3.0" + } + }, + "requires-port": { + "version": "1.0.0", + "bundled": true + }, + "resolve": { + "version": "1.8.1", + "bundled": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "requires": { + "glob": "7.1.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true + }, + "semver": { + "version": "5.5.0", + "bundled": true + }, + "shelljs": { + "version": "0.8.2", + "bundled": true, + "requires": { + "glob": "7.1.2", + "interpret": "1.1.0", + "rechoir": "0.6.2" + } + }, + "shx": { + "version": "0.3.1", + "bundled": true, + "requires": { + "es6-object-assign": "1.1.0", + "minimist": "1.2.0", + "shelljs": "0.8.2" + } + }, + "source-map": { + "version": "0.6.1", + "bundled": true + }, + "source-map-support": { + "version": "0.5.6", + "bundled": true, + "requires": { + "buffer-from": "1.1.0", + "source-map": "0.6.1" + } + }, + "split": { + "version": "0.3.3", + "bundled": true, + "requires": { + "through": "2.3.8" + } + }, + "sshpk": { + "version": "1.14.2", + "bundled": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "safer-buffer": "2.1.2", + "tweetnacl": "0.14.5" + } + }, + "stat-mode": { + "version": "0.2.2", + "bundled": true + }, + "stream-combiner": { + "version": "0.0.4", + "bundled": true, + "requires": { + "duplexer": "0.1.1" + } + }, + "stream-shift": { + "version": "1.0.0", + "bundled": true + }, + "streamfilter": { + "version": "1.0.7", + "bundled": true, + "requires": { + "readable-stream": "2.3.6" + } + }, + "streamifier": { + "version": "0.1.1", + "bundled": true + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "strip-bom": { + "version": "2.0.0", + "bundled": true, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-bom-stream": { + "version": "1.0.0", + "bundled": true, + "requires": { + "first-chunk-stream": "1.0.0", + "strip-bom": "2.0.0" + } + }, + "supports-color": { + "version": "4.4.0", + "bundled": true, + "requires": { + "has-flag": "2.0.0" + } + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "through": { + "version": "2.3.8", + "bundled": true + }, + "through2": { + "version": "2.0.3", + "bundled": true, + "requires": { + "readable-stream": "2.3.6", + "xtend": "4.0.1" + } + }, + "through2-filter": { + "version": "2.0.0", + "bundled": true, + "requires": { + "through2": "2.0.3", + "xtend": "4.0.1" + } + }, + "to-absolute-glob": { + "version": "0.1.1", + "bundled": true, + "requires": { + "extend-shallow": "2.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "bundled": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "tough-cookie": { + "version": "2.3.4", + "bundled": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "optional": true + }, + "unique-stream": { + "version": "2.2.1", + "bundled": true, + "requires": { + "json-stable-stringify": "1.0.1", + "through2-filter": "2.0.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "uuid": { + "version": "3.3.0", + "bundled": true + }, + "vali-date": { + "version": "1.0.0", + "bundled": true + }, + "verror": { + "version": "1.10.0", + "bundled": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + }, + "vinyl": { + "version": "0.4.6", + "bundled": true, + "requires": { + "clone": "0.2.0", + "clone-stats": "0.0.1" + } + }, + "vinyl-fs": { + "version": "2.4.4", + "bundled": true, + "requires": { + "duplexify": "3.6.0", + "glob-stream": "5.3.5", + "graceful-fs": "4.1.11", + "gulp-sourcemaps": "1.6.0", + "is-valid-glob": "0.3.0", + "lazystream": "1.0.0", + "lodash.isequal": "4.5.0", + "merge-stream": "1.0.1", + "mkdirp": "0.5.1", + "object-assign": "4.1.1", + "readable-stream": "2.3.6", + "strip-bom": "2.0.0", + "strip-bom-stream": "1.0.0", + "through2": "2.0.3", + "through2-filter": "2.0.0", + "vali-date": "1.0.0", + "vinyl": "1.2.0" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "bundled": true + }, + "replace-ext": { + "version": "0.0.1", + "bundled": true + }, + "vinyl": { + "version": "1.2.0", + "bundled": true, + "requires": { + "clone": "1.0.4", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + } + } + } + }, + "vinyl-source-stream": { + "version": "1.1.2", + "bundled": true, + "requires": { + "through2": "2.0.3", + "vinyl": "0.4.6" + } + }, + "vscode": { + "version": "1.1.21", + "bundled": true, + "requires": { + "glob": "7.1.2", + "gulp-chmod": "2.0.0", + "gulp-filter": "5.1.0", + "gulp-gunzip": "1.0.0", + "gulp-remote-src-vscode": "0.5.0", + "gulp-symdest": "1.1.0", + "gulp-untar": "0.0.7", + "gulp-vinyl-zip": "2.1.0", + "mocha": "4.1.0", + "request": "2.87.0", + "semver": "5.5.0", + "source-map-support": "0.5.6", + "url-parse": "1.4.3", + "vinyl-source-stream": "1.1.2" + }, + "dependencies": { + "url-parse": { + "version": "1.4.3", + "bundled": true, + "requires": { + "querystringify": "2.0.0", + "requires-port": "1.0.0" + } + } + } + }, + "vscode-jsonrpc": { + "version": "4.0.0", + "bundled": true + }, + "vscode-languageserver-protocol": { + "version": "3.14.1", + "bundled": true, + "requires": { + "vscode-jsonrpc": "4.0.0", + "vscode-languageserver-types": "3.14.0" + }, + "dependencies": { + "vscode-jsonrpc": { + "version": "4.0.0", + "bundled": true + }, + "vscode-languageserver-types": { + "version": "3.14.0", + "bundled": true + } + } + }, + "vscode-languageserver-types": { + "version": "3.14.0", + "bundled": true + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "xtend": { + "version": "4.0.1", + "bundled": true + }, + "yauzl": { + "version": "2.9.2", + "bundled": true, + "requires": { + "buffer-crc32": "0.2.13", + "fd-slicer": "1.1.0" + } + }, + "yazl": { + "version": "2.4.3", + "bundled": true, + "requires": { + "buffer-crc32": "0.2.13" + } + } } }, - "vscode-languageserver-protocol": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", - "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", - "requires": { - "vscode-jsonrpc": "4.0.0", - "vscode-languageserver-types": "3.14.0" - } - }, - "vscode-languageserver-types": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", - "integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A==" - }, "vso-node-api": { "version": "6.1.2-preview", "resolved": "https://registry.npmjs.org/vso-node-api/-/vso-node-api-6.1.2-preview.tgz", diff --git a/editors/code/package.json b/editors/code/package.json index d53e44b21701..7dc9d606ac41 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -15,6 +15,7 @@ "engines": { "vscode": "^1.30.0" }, + "enableProposedApi": true, "scripts": { "vscode:prepublish": "npm run compile", "package": "vsce package", @@ -31,7 +32,7 @@ "singleQuote": true }, "dependencies": { - "vscode-languageclient": "^5.2.1" + "vscode-languageclient": "file:///home/matklad/projects/vscode-languageserver-node/client/" }, "devDependencies": { "@types/mocha": "^2.2.42", diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index 75e273f37391..ad063f449d37 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts @@ -1,5 +1,6 @@ import * as lc from 'vscode-languageclient'; +import { ProposedFeatures } from 'vscode-languageclient'; import { Config } from './config'; import { Highlighter } from './highlighting'; @@ -32,6 +33,7 @@ export class Server { serverOptions, clientOptions ); + Server.client.registerProposedFeatures() Server.client.onReady().then(() => { for (const [type, handler] of notificationHandlers) { Server.client.onNotification(type, handler);