bash-language-server
Advanced tools
Comparing version 1.5.0 to 1.5.1
# Bash Language Server | ||
## 1.5.1 | ||
* Upgrade `tree-sitter` and `tree-sitter-bash` | ||
* Fixed build issue with 1.5.0 | ||
## 1.5.0 | ||
@@ -4,0 +9,0 @@ |
@@ -16,3 +16,3 @@ "use strict"; | ||
const request = require("request-promise-native"); | ||
const tree_sitter_1 = require("tree-sitter"); | ||
const Parser = require("tree-sitter"); | ||
const bash = require("tree-sitter-bash"); | ||
@@ -31,3 +31,3 @@ const URI = require("urijs"); | ||
this.uriToTextDocument = {}; | ||
this.uriToTreeSitterDocument = {}; | ||
this.uriToTreeSitterTrees = {}; | ||
// We need this to find the word at a given point etc. | ||
@@ -86,3 +86,3 @@ this.uriToFileContent = {}; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const leafNode = this.uriToTreeSitterDocument[pos.textDocument.uri].rootNode.descendantForPosition({ | ||
const leafNode = this.uriToTreeSitterTrees[pos.textDocument.uri].rootNode.descendantForPosition({ | ||
row: pos.position.line, | ||
@@ -131,3 +131,3 @@ column: pos.position.character, | ||
findReferences(name) { | ||
const uris = Object.keys(this.uriToTreeSitterDocument); | ||
const uris = Object.keys(this.uriToTreeSitterTrees); | ||
return flatten_1.flattenArray(uris.map(uri => this.findOccurrences(uri, name))); | ||
@@ -140,6 +140,6 @@ } | ||
findOccurrences(uri, query) { | ||
const doc = this.uriToTreeSitterDocument[uri]; | ||
const tree = this.uriToTreeSitterTrees[uri]; | ||
const contents = this.uriToFileContent[uri]; | ||
const locations = []; | ||
TreeSitterUtil.forEach(doc.rootNode, n => { | ||
TreeSitterUtil.forEach(tree.rootNode, n => { | ||
let name = null; | ||
@@ -193,12 +193,11 @@ let rng = null; | ||
const contents = document.getText(); | ||
const d = new tree_sitter_1.Document(); | ||
d.setLanguage(bash); | ||
d.setInputString(contents); | ||
d.parse(); | ||
const parser = new Parser(); | ||
parser.setLanguage(bash); | ||
const tree = parser.parse(contents); | ||
this.uriToTextDocument[uri] = document; | ||
this.uriToTreeSitterDocument[uri] = d; | ||
this.uriToTreeSitterTrees[uri] = tree; | ||
this.uriToDeclarations[uri] = {}; | ||
this.uriToFileContent[uri] = contents; | ||
const problems = []; | ||
TreeSitterUtil.forEach(d.rootNode, n => { | ||
TreeSitterUtil.forEach(tree.rootNode, n => { | ||
if (n.type === 'ERROR') { | ||
@@ -226,3 +225,3 @@ problems.push(LSP.Diagnostic.create(TreeSitterUtil.range(n), 'Failed to parse expression', LSP.DiagnosticSeverity.Error)); | ||
wordAtPoint(uri, line, column) { | ||
const document = this.uriToTreeSitterDocument[uri]; | ||
const document = this.uriToTreeSitterTrees[uri]; | ||
const contents = this.uriToFileContent[uri]; | ||
@@ -229,0 +228,0 @@ const node = document.rootNode.namedDescendantForPosition({ row: line, column }); |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"publisher": "mads-hartmann", | ||
@@ -31,5 +31,6 @@ "main": "out/server.js", | ||
"scripts": { | ||
"compile": "rm -rf out && tsc -p ./", | ||
"compile:watch": "tsc -w -p ./" | ||
"compile": "rm -rf out && ../node_modules/.bin/tsc -p ./", | ||
"compile:watch": "../node_modules/.bin/tsc -w -p ./", | ||
"prepublishOnly": "yarn run compile" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148181
1788