Skip to content

Commit 4b4e4bf

Browse files
authoredJan 6, 2023
Merge pull request #661 from bash-lsp/stop-wasting-resources
Stop wasting CPU cycles and memory for large workspaces
2 parents af2e72c + 7a14ab3 commit 4b4e4bf

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed
 

‎docs/development-guide.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
There are two moving parts.
44

55
- **Server**: A node server written in Typescript that implements the
6-
[Language Server Protocol (LSP)][LSP].
6+
[Language Server Protocol (LSP)][lsp].
77

88
**Client**: A Visual Studio Code (vscode) extension which wraps the LSP server.
99

@@ -75,7 +75,6 @@ yarn link-server
7575

7676
After that follow the steps above to work on the client.
7777

78-
7978
## Working on the server (standalone)
8079

8180
If you are working on the server outside of VS Code, then simply compile
@@ -86,7 +85,14 @@ reload your vscode window to re-launch the server.
8685
yarn run reinstall-server
8786
```
8887

89-
[LSP]: https://microsoft.github.io/language-server-protocol/
88+
## Performance
89+
90+
To analyze the performance of the extension or server using the Chrome inspector:
91+
92+
1. In Code start debugging "Run -> Start debugging"
93+
2. Open `chrome://inspect` in Chrome and ensure the port `localhost:6009` is added
94+
95+
[lsp]: https://microsoft.github.io/language-server-protocol/
9096
[ide-bash]: https://github.com/bash-lsp/ide-bash
9197
[jest]: https://facebook.github.io/jest/
9298
[prettier]: https://prettier.io/

‎server/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Bash Language Server
22

3+
## 4.2.5
4+
5+
- Fix a critical bug causing memory leaks and high CPU usage for workspaces with many files https://github.com/bash-lsp/bash-language-server/pull/661
6+
37
## 4.2.4
48

59
- Increase ShellCheck execution delay to 500ms after typing ends.

‎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": "4.2.4",
6+
"version": "4.2.5",
77
"main": "./out/server.js",
88
"typings": "./out/server.d.ts",
99
"bin": {

‎server/src/util/fs.ts

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export async function getFilePaths({
3939
let i = 0
4040
for await (const fileEntry of stream) {
4141
if (i >= maxItems) {
42+
// NOTE: Close the stream to stop reading files paths.
43+
stream.emit('close')
4244
break
4345
}
4446

0 commit comments

Comments
 (0)
Please sign in to comment.