Skip to content

Commit 1b49262

Browse files
committed
Basic support for Atom
1 parent be449fc commit 1b49262

File tree

4 files changed

+194
-2
lines changed

4 files changed

+194
-2
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
1-
# ide-bash
2-
Bash language support for Atom-IDE
1+
# Bash IDE
2+
3+
Bash language server. Uses [Tree Sitter][tree-sitter] and its
4+
[grammar for Bash][tree-sitter-bash].
5+
6+
## System Requirements
7+
8+
You need to install that language server separately as it depends on native node
9+
modules.
10+
11+
```bash
12+
npm i -g bash-language-server
13+
```
14+
15+
## Features
16+
17+
- [x] Jump to declaration
18+
- [x] Find references
19+
- [x] Code Outline & Show Symbols
20+
- [x] Highlight occurrences
21+
- [x] Code completion
22+
- [x] Simple diagnostics reporting
23+
- [ ] Rename symbol
24+
25+
[tree-sitter]: https://github.com/tree-sitter/tree-sitter
26+
[tree-sitter-bash]: https://github.com/tree-sitter/tree-sitter-bash

package-lock.json

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "ide-bash",
3+
"version": "1.0.0",
4+
"description": "Language Bash language support for Atom-IDE",
5+
"main": "src/main.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/mads-hartmann/bash-language-server.git"
9+
},
10+
"author": "Mads Hartmann <mads3379@gmail.com> (https://twitter.com/mads_hartmann)",
11+
"license": "MIT",
12+
"bugs": {
13+
"url": "https://github.com/mads-hartmann/bash-language-server/issues"
14+
},
15+
"homepage": "https://github.com/mads-hartmann/bash-language-server#readme",
16+
"dependencies": {
17+
"atom-languageclient": "^0.9.2"
18+
},
19+
"enhancedScopes": [
20+
"source.shell"
21+
],
22+
"providedServices": {
23+
"autocomplete.provider": {
24+
"versions": {
25+
"2.0.0": "provideAutocomplete"
26+
}
27+
},
28+
"code-highlight": {
29+
"versions": {
30+
"0.1.0": "provideCodeHighlight"
31+
}
32+
},
33+
"definitions": {
34+
"versions": {
35+
"0.1.0": "provideDefinitions"
36+
}
37+
},
38+
"find-references": {
39+
"versions": {
40+
"0.1.0": "provideFindReferences"
41+
}
42+
},
43+
"outline-view": {
44+
"versions": {
45+
"0.1.0": "provideOutlines"
46+
}
47+
}
48+
}
49+
}

src/main.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
const ChildProcess = require("child_process");
2+
const Path = require('path')
3+
const {AutoLanguageClient} = require('atom-languageclient')
4+
5+
class BashLanguageClient extends AutoLanguageClient {
6+
7+
getGrammarScopes () {
8+
return [ 'source.shell' ]
9+
}
10+
11+
getLanguageName () {
12+
return 'Shell Script'
13+
}
14+
15+
getServerName () {
16+
return 'BashIDE'
17+
}
18+
19+
async startServerProcess(projectPath) {
20+
21+
// The bash-language-server uses '#!/usr/bin/env node' to find the version
22+
// of node to use so we'll have to wait until the shell environment has been
23+
// loaded
24+
await new Promise(resolve => atom.whenShellEnvironmentLoaded(resolve));
25+
26+
const command = 'bash-language-server'
27+
const args = ["start"]
28+
29+
const childProcess = ChildProcess.spawn(command, args, {
30+
cwd: projectPath
31+
});
32+
33+
childProcess.on("error", err =>
34+
atom.notifications.addError("Unable to start the Bash language server.", {
35+
dismissable: true,
36+
buttons: [
37+
{
38+
text: "Install Instructions",
39+
onDidClick: () => atom.workspace.open("atom://config/packages/ide-bash")
40+
}
41+
],
42+
description:
43+
"Please make sure you've followed the System Requirements section in the README"
44+
})
45+
);
46+
47+
super.captureServerErrors(childProcess, projectPath)
48+
49+
return childProcess;
50+
51+
}
52+
53+
}
54+
55+
module.exports = new BashLanguageClient()

0 commit comments

Comments
 (0)