Skip to content

Commit 502b3de

Browse files
authored
Merge pull request #911 from bash-lsp/downgrade-tree-sitter
Downgrade tree sitter bash
2 parents cb08faf + 0d164ed commit 502b3de

File tree

6 files changed

+10
-18
lines changed

6 files changed

+10
-18
lines changed

Diff for: server/CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
## 5.0.0 (beta)
44

5-
- Drop support for Node.js 14 that is no longer maintained (security updates ended 30 Apr 2023)
6-
- Internal changes: switch from yarn classic to pnpm
5+
- Downgrade tree sitter to a stable version https://github.com/bash-lsp/bash-language-server/pull/911
6+
- Drop support for Node.js 14 that is no longer maintained (security updates ended 30 Apr 2023) https://github.com/bash-lsp/bash-language-server/pull/893
7+
- Internal changes: switch from yarn classic to pnpm https://github.com/bash-lsp/bash-language-server/pull/893
78

89
## 4.10.3
910

Diff for: server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "A language server for Bash",
44
"author": "Mads Hartmann",
55
"license": "MIT",
6-
"version": "5.0.0-rc1",
6+
"version": "5.0.0-rc2",
77
"main": "./out/server.js",
88
"typings": "./out/server.d.ts",
99
"bin": {

Diff for: server/parser.info

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
"https://api.github.com/repos/tree-sitter/tree-sitter-bash/git/commits/ee2a8f9906b53a785b784ee816c0016c2b6866d2"
2-
tree-sitter-cli "0.20.8"
1+
"https://api.github.com/repos/tree-sitter/tree-sitter-bash/git/commits/4488aa41406547e478636a4fcfd24f5bbc3f2f74"
2+
tree-sitter-cli "0.20.7"

Diff for: server/src/__tests__/analyzer.test.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ describe('analyze', () => {
144144
expect(diagnostics3).toEqual([])
145145
})
146146

147-
it('handles tree-sitter crashes gracefully', async () => {
147+
it('ensures tree-sitter does not crash', async () => {
148+
// newer version of tree-sitter will crash on this file and never respond
149+
// to new queries.
148150
const analyzer = await getAnalyzer({ runBackgroundAnalysis: false })
149151

150152
// Parse the file
@@ -153,11 +155,6 @@ describe('analyze', () => {
153155
document: FIXTURE_DOCUMENT.CRASH,
154156
})
155157

156-
expect(loggerWarn).toHaveBeenCalled()
157-
expect(loggerWarn.mock.calls).toEqual([
158-
[expect.stringContaining('Tree sitter crashed while parsing')],
159-
])
160-
161158
const result = analyzer.findAllSourcedUris({ uri: FIXTURE_URI.CRASH })
162159
expect(result).toEqual(new Set([]))
163160
})

Diff for: server/src/analyser.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,8 @@ export default class Analyzer {
7070
}): LSP.Diagnostic[] {
7171
const diagnostics: LSP.Diagnostic[] = []
7272
const fileContent = document.getText()
73-
let tree: Parser.Tree
7473

75-
try {
76-
tree = this.parser.parse(fileContent)
77-
} catch (error) {
78-
logger.warn(`Tree sitter crashed while parsing ${uri}: ${error}`)
79-
return []
80-
}
74+
const tree = this.parser.parse(fileContent)
8175

8276
const globalDeclarations = getGlobalDeclarations({ tree, uri })
8377

Diff for: server/tree-sitter-bash.wasm

-8.05 KB
Binary file not shown.

0 commit comments

Comments
 (0)