sublimelsp / lsp-bash Goto Github PK
View Code? Open in Web Editor NEWBash support for Sublime's LSP plugin provided through bash-language-server.
License: MIT License
Bash support for Sublime's LSP plugin provided through bash-language-server.
License: MIT License
First of all - sorry if this is a configuration issue on my part and not an issue with the package itself - I am new to both Sublime and LSPs.
I installed the LSP following the doc's to the best of my advice - upon start the LSP is listed as up and running and Sublime's log says that there were no issues with the startup of the program or any of the packages.
Then when I right click on a variable inside a bash file to access the LSP sub menu all the options are grayed out except for:
'Go To Symbol Reference' & 'Find Symbol Definition'.
I have not added any configs of my own - the LSP & Sublime are using their default supplied configs.
Can anybody shed some light into this, or help me continue debugging ?
Line 31 in bd72521
Someone should write a NodeBasedLanguageHandler base class by the way. A lot of these helper packages are starting to look the same :)
This is my LSP.sublime-settings that I use to enable lsp-clangd plugin
// Settings in here override those in "LSP/LSP.sublime-settings"
{
"inhibit_snippet_completions": true,
"show_view_status": false,
"clients": {
"clangd": {
"enabled": true,
"command": [
"clangd", // you may use an absolute path for this clangd executable
"-function-arg-placeholders=0",
"-header-insertion-decorators=1",
"-background-index",
"-j=3",
],
"scopes": ["source.c", "source.c++", "source.objc", "source.objc++"],
"syntaxes": [
"Packages/C++/C.sublime-syntax",
"Packages/C++/C++.sublime-syntax",
"Packages/Objective-C/Objective-C.sublime-syntax",
"Packages/Objective-C/Objective-C++.sublime-syntax",
],
"languageId": "cpp",
}
}
}
Since bash-language-server 3.2.0, the language server by default enables ShellCheck if it finds that it's installed. However, it seems that setting it to an empty string rather than not having it at all disables this default behavior.
Relevant changelog:
https://github.com/bash-lsp/bash-language-server/blob/main/server/CHANGELOG.md#320
When running shellcheck linting, I'm seeing the following error in the lsp log panel:
LSP-bash: 14:32:55.143 ERROR Error while linting: TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
where the url is buffer://sublime/x
. It looks like only file
is supported as a scheme here. Saving as a file fixes this.
updateConfiguration
failingIn other words, there is no way to set backgroundAnalysisMaxFiles
or BACKGROUND_ANALYSIS_MAX_FILES
:: -> LSP-bash initialized: {}
:: -> LSP-bash workspace/didChangeConfiguration: {'settings': {'backgroundAnalysisMaxFiles': 5}}
LSP-bash: Environment variable configuration is being deprecated, please use workspace configuration. The following environment variables were used: shellcheckPath
:: <- LSP-bash window/logMessage: {'type': 2, 'message': 'Environment variable configuration is being deprecated, please use workspace configuration. The following environment variables were used: shellcheckPath'}
:: <-- LSP-bash client/registerCapability(0): {'registrations': [{'id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'method': 'workspace/didChangeConfiguration', 'registerOptions': {'section': 'bashIde'}}]}
:: >>> LSP-bash 0: None
:: <-- LSP-bash workspace/configuration(1): {'items': [{'section': 'bashIde'}]}
:: >>> LSP-bash 1: [None]
LSP-bash: updateConfiguration: failed with [
{
"code": "invalid_type",
"expected": "object",
"received": "null",
"path": [],
"message": "Expected object, received null"
}
]
:: <- LSP-bash window/logMessage: {'type': 2, 'message': 'updateConfiguration: failed with [\n {\n "code": "invalid_type",\n "expected": "object",\n "received": "null",\n "path": [],\n "message": "Expected object, received null"\n }\n]'}
{
"env": {
"BACKGROUND_ANALYSIS_MAX_FILES": 0,
},
}
Having the README as an install message is a little weird and confusing because it gives information on how to install the package when it was just installed.
Line 3 in b8f3fcf
(but I also do see that it removes some duplication of having to maintain two descriptions.)
So after updating to the latest sublime version, lsp-bash
seems to crash all of the time. I have gathered a diagnostic report:
/home/noah/.cache/sublime-text-3/Package Storage/LSP-bash/10.19.0/language-server/node_modules/web-tree-sitter/tree-sitter.js:1
var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.TreeSitter=t()}(0,function(){var e,t={};for(e in Module)Module.hasOwnProperty(e)&&(t[e]=Module[e]);var r,n,s=[],o="./this.program",_=function(e,t){throw t},a=!1,u=!1;a="object"==typeof window,u="function"==typeof importScripts,r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,n=!a&&!r&&!u;var i,l,d,c,m,f="";r?(f=u?require("path").dirname(f)+"/":__dirname+"/",i=function(e,t){return c||(c=require("fs")),m||(m=require("path")),e=m.normalize(e),c.readFileSync(e,t?null:"utf8")},d=function(e){var t=i(e,!0);return t.buffer||(t=new Uint8Array(t)),N(t.buffer),t},process.argv.length>1&&(o=process.argv[1].replace(/\\/g,"/")),s=process.argv.slice(2),"undefined"!=typeof module&&(module.export
TypeError: WebAssembly.Global is not a constructor
at /home/noah/.cache/sublime-text-3/Package Storage/LSP-bash/10.19.0/language-server/node_modules/web-tree-sitter/tree-sitter.js:1:12512
at /home/noah/.cache/sublime-text-3/Package Storage/LSP-bash/10.19.0/language-server/node_modules/web-tree-sitter/tree-sitter.js:1:144
at Object.<anonymous> (/home/noah/.cache/sublime-text-3/Package Storage/LSP-bash/10.19.0/language-server/node_modules/web-tree-sitter/tree-sitter.js:1:170)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
[
"${node_bin}",
"${server_path}",
"start"
]
/usr/bin/node "/home/noah/.cache/sublime-text-3/Package Storage/LSP-bash/10.19.0/language-server/node_modules/bash-language-server/bin/main.js" start
(source.shell.bash)
(source.bash)
{}
{}
{
"EXPLAINSHELL_ENDPOINT": "",
"GLOB_PATTERN": "",
"HIGHLIGHT_PARSING_ERRORS": "0",
"PATH": "/usr/bin:/usr/bin:"
}
/home/noah/open-source/pip/src/pip/_internal/commands/configuration.py
{
"auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
"lsp_active": null,
"syntax": "Packages/Python/Python.sublime-syntax"
}
source.python
[
"/home/noah/open-source/pip"
]
{
"folders": [
{
"path": "."
}
]
}
{
"clients": {
"bashls": {
"enabled": true
},
"clangd": {
"enabled": true
},
"pyls": {
"enabled": true
},
"rust-analyzer": {
"enabled": true
}
},
"disabled_capabilities": [
"completion"
]
}
Running into the following initialization error on fresh install (prompt says crash loop):
LSP-bash: internal/modules/cjs/loader.js:883
LSP-bash: throw err;
LSP-bash: ^
LSP-bash:
LSP-bash: Error: Cannot find module 'node:child_process'
LSP-bash: Require stack:
LSP-bash: - /Users/<my_username>/Library/Caches/Sublime Text/Package Storage/LSP-bash/14.16.0/language-server/node_modules/bash-language-server/out/server.js
LSP-bash: - /Users/<my_username>/Library/Caches/Sublime Text/Package Storage/LSP-bash/14.16.0/language-server/node_modules/bash-language-server/out/cli.js
LSP-bash: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
LSP-bash: at Function.Module._load (internal/modules/cjs/loader.js:725:27)
LSP-bash: at Module.require (internal/modules/cjs/loader.js:952:19)
LSP-bash: at require (internal/modules/cjs/helpers.js:88:18)
LSP-bash: at Object.<anonymous> (/Users/bli/Library/Caches/Sublime Text/Package Storage/LSP-bash/14.16.0/language-server/node_modules/bash-language-server/out/server.js:12:30)
LSP-bash: at Module._compile (internal/modules/cjs/loader.js:1063:30)
LSP-bash: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
LSP-bash: at Module.load (internal/modules/cjs/loader.js:928:32)
LSP-bash: at Function.Module._load (internal/modules/cjs/loader.js:769:14)
LSP-bash: at Module.require (internal/modules/cjs/loader.js:952:19) {
LSP-bash: code: 'MODULE_NOT_FOUND',
LSP-bash: requireStack: [
LSP-bash: '/Users/<my_username>/Library/Caches/Sublime Text/Package Storage/LSP-bash/14.16.0/language-server/node_modules/bash-language-server/out/server.js',
LSP-bash: '/Users/<my_username>/Library/Caches/Sublime Text/Package Storage/LSP-bash/14.16.0/language-server/node_modules/bash-language-server/out/cli.js'
LSP-bash: ]
LSP-bash: }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.