Skip to content

Commit fee5ce6

Browse files
authored
Merge pull request #938 from ackalker/ackalker/issue937
Installed bash_language_server not detected / not usable
2 parents 39ee7d9 + f02c301 commit fee5ce6

File tree

10 files changed

+188
-303
lines changed

10 files changed

+188
-303
lines changed

atest/01_Editor.robot

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ Test Tags ui:editor aspect:ls:features
99

1010
*** Test Cases ***
1111
Bash
12-
Editor Shows Features for Language Bash example.sh Diagnostics=Failed to parse expression
12+
Editor Shows Features for Language
13+
... Bash
14+
... example.sh
15+
... Diagnostics=Double quote to prevent globbing and word splitting.
1316
... Jump to Definition=fib
1417

1518
CSS

atest/03_Notebook.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ Moving Cells Around
4949
Foreign Extractors
5050
${file} = Set Variable Foreign extractors.ipynb
5151
Configure JupyterLab Plugin
52-
... {"language_servers": {"texlab": {"serverSettings": {"chktex.onOpenAndSave": true}}, "bash-langauge-server": {"bashIde.highlightParsingErrors": true}}, "pylsp": {"priority": 1000}}
52+
... {"language_servers": {"texlab": {"serverSettings": {"chktex.onOpenAndSave": true}}, "bash-langauge-server": {"bashIde.enableSourceErrorDiagnostics": true}}, "pylsp": {"priority": 1000}}
5353
Capture Page Screenshot 10-configured.png
5454
Reset Application State
5555
Setup Notebook Python ${file}
5656
@{diagnostics} = Create List
57-
... Failed to parse expression # bash, configured by spec.env
57+
... Double quote to prevent globbing and word splitting # bash, configured by spec.env
5858
... ame 'valid' # python, mypy and pyflakes will fight over `(N|n)ame 'valid'`, just hope for the best
5959
... Trailing whitespace is superfluous. # r
6060
... `frob` is misspelt # markdown

atest/examples/Foreign extractors.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"outputs": [],
6565
"source": [
6666
"%%bash\n",
67-
"echo $"
67+
"echo $MY_VAR"
6868
]
6969
},
7070
{
@@ -105,7 +105,7 @@
105105
],
106106
"metadata": {
107107
"kernelspec": {
108-
"display_name": "Python 3",
108+
"display_name": "Python 3 (ipykernel)",
109109
"language": "python",
110110
"name": "python3"
111111
},
@@ -119,7 +119,7 @@
119119
"name": "python",
120120
"nbconvert_exporter": "python",
121121
"pygments_lexer": "ipython3",
122-
"version": "3.7.9"
122+
"version": "3.10.6"
123123
}
124124
},
125125
"nbformat": 4,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"devDependencies": {
44
"@typescript-eslint/eslint-plugin": "^5.46.0",
55
"@typescript-eslint/parser": "^5.46.0",
6-
"bash-language-server": "^3.0.0",
6+
"bash-language-server": "^4.9.2",
77
"dictionary-en": "^3.0.0",
88
"dockerfile-language-server-nodejs": "^0.7.1",
99
"eslint": "^8.29.0",

packages/jupyterlab-lsp/schema/plugin.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@
3131
"properties": {
3232
"language_servers": {
3333
"title": "Language Server",
34-
"description": "Language-server specific configuration, keyed by implementation, e.g: \n\npyls: {\n serverSettings: {\n pyls: {\n plugins: {\n pydocstyle: {\n enabled: true\n },\n pyflakes: {\n enabled: false\n },\n flake8: {\n enabled: true\n }\n }\n }\n }\n}\n\nAlternatively, using VSCode's naming convention:\n\npyls: {\n serverSettings: {\n \"pyls.plugins.pydocstyle.enabled\": true,\n \"pyls.plugins.pyflakes.enabled\": false,\n \"pyls.plugins.flake8.enabled\": true\n }\n}",
34+
"description": "Language-server specific configuration, keyed by implementation, e.g: \n\npyls: {\n serverSettings: {\n pyls: {\n plugins: {\n pydocstyle: {\n enabled: true\n },\n pyflakes: {\n enabled: false\n },\n flake8: {\n enabled: true\n }\n }\n }\n }\n}\n\nAlternatively, using dotted naming convention:\n\npyls: {\n serverSettings: {\n \"pyls.plugins.pydocstyle.enabled\": true,\n \"pyls.plugins.pyflakes.enabled\": false,\n \"pyls.plugins.flake8.enabled\": true\n }\n}",
3535
"default": {
3636
"pyright": {
3737
"serverSettings": {
3838
"python.analysis.useLibraryCodeForTypes": true
3939
}
40+
},
41+
"bash-language-server": {
42+
"serverSettings": {
43+
"bashIde.enableSourceErrorDiagnostics": true
44+
}
4045
}
4146
},
4247
"patternProperties": {
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
from ..types import LanguageServerManagerAPI
12
from .config import load_config_schema
23
from .utils import NodeModuleSpec
34

45

56
class BashLanguageServer(NodeModuleSpec):
67
node_module = key = "bash-language-server"
7-
script = ["bin", "main.js"]
8+
script = ["out", "cli.js"]
9+
fallback_script = ["bin", "main.js"]
810
args = ["start"]
911
languages = ["bash", "sh"]
1012
spec = dict(
1113
display_name=key,
1214
mime_types=["text/x-sh", "application/x-sh"],
1315
urls=dict(
14-
home="https://github.com/mads-hartmann/{}".format(key),
15-
issues="https://github.com/mads-hartmann/{}/issues".format(key),
16+
home="https://github.com/bash-lsp/{}".format(key),
17+
issues="https://github.com/bash-lsp/{}/issues".format(key),
1618
),
1719
install=dict(
1820
npm="npm install --save-dev {}".format(key),
@@ -21,3 +23,11 @@ class BashLanguageServer(NodeModuleSpec):
2123
),
2224
config_schema=load_config_schema(key),
2325
)
26+
27+
def solve(self, mgr: LanguageServerManagerAPI):
28+
new_path = mgr.find_node_module(self.node_module, *self.script)
29+
if new_path:
30+
return new_path
31+
return mgr.find_node_module(
32+
self.node_module, *self.fallback_script
33+
) # pragma: no cover

python_packages/jupyter_lsp/jupyter_lsp/specs/config/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
These are configuration schemas extracted from canonical upstreams:
44

5-
- [bash-language-server](https://github.com/mads-hartmann/bash-language-server/blob/master/vscode-client/package.json)
6-
- [pyls](https://github.com/palantir/python-language-server/blob/develop/vscode-client/package.json)
5+
- [bash-language-server](https://github.com/bash-lsp/bash-language-server/blob/master/vscode-client/package.json)
6+
- [pylsp](https://github.com/python-lsp/python-lsp-server/blob/develop/pylsp/config/schema.json)
77
- [dockerfile-language-server-nodejs](https://github.com/microsoft/vscode-docker/blob/master/package.json)
88
- [yaml-language-server](https://github.com/redhat-developer/vscode-yaml/blob/master/package.json)
99

1010
> All of the configurations are sent to the Language Server, but only some of them
11-
> are actually acted upon, but we don't which is which, yet.
11+
> are actually acted upon, but we don't know which is which, yet.

python_packages/jupyter_lsp/jupyter_lsp/specs/config/bash-language-server.schema.json

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,47 @@
22
"type": "object",
33
"title": "Bash IDE configuration",
44
"properties": {
5+
"bashIde.backgroundAnalysisMaxFiles": {
6+
"type": "number",
7+
"default": 500,
8+
"description": "Maximum number of files to analyze in the background. Set to 0 to disable background analysis.",
9+
"minimum": 0
10+
},
11+
"bashIde.enableSourceErrorDiagnostics": {
12+
"type": "boolean",
13+
"default": false,
14+
"description": "Enable diagnostics for source errors. Ignored if includeAllWorkspaceSymbols is true."
15+
},
16+
"bashIde.explainshellEndpoint": {
17+
"type": "string",
18+
"default": "",
19+
"description": "Configure explainshell server endpoint in order to get hover documentation on flags and options."
20+
},
521
"bashIde.globPattern": {
622
"type": "string",
723
"default": "**/*@(.sh|.inc|.bash|.command)",
8-
"description": "Glob pattern for finding and parsing shell script files."
24+
"description": "Glob pattern for finding and parsing shell script files in the workspace. Used by the background analysis features across files."
925
},
10-
"bashIde.highlightParsingErrors": {
26+
"bashIde.includeAllWorkspaceSymbols": {
1127
"type": "boolean",
1228
"default": false,
13-
"description": "Controls if parsing errors will be highlighted as problems."
29+
"description": "Controls how symbols (e.g. variables and functions) are included and used for completion and documentation. If false (default and recommended), then we only include symbols from sourced files (i.e. using non dynamic statements like 'source file.sh' or '. file.sh' or following ShellCheck directives). If true, then all symbols from the workspace are included."
1430
},
15-
"bashIde.explainshellEndpoint": {
31+
"bashIde.logLevel": {
32+
"type": "string",
33+
"default": "info",
34+
"enum": ["debug", "info", "warning", "error"],
35+
"description": "Controls the log level of the language server."
36+
},
37+
"bashIde.shellcheckPath": {
38+
"type": "string",
39+
"default": "shellcheck",
40+
"description": "Controls the executable used for ShellCheck linting information. An empty string will disable linting."
41+
},
42+
"bashIde.shellcheckArguments": {
1643
"type": "string",
1744
"default": "",
18-
"description": "Configure explainshell server in order to get hover documentation on flags and options."
45+
"description": "Additional ShellCheck arguments. Note that we already add the following arguments: --shell, --format, --external-sources."
1946
}
2047
}
2148
}

requirements/github-actions.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ dependencies:
2727
- r-languageserver
2828
- r-stringi >=1.4.6
2929
- rpy2
30+
# bash-language-server
31+
- shellcheck
3032
# tex
3133
- tectonic
3234
- texlab

0 commit comments

Comments
 (0)