sh
efm-langserver
Our great sponsors
sh | efm-langserver | |
---|---|---|
21 | 50 | |
6,702 | 1,266 | |
- | - | |
7.8 | 6.9 | |
9 days ago | 11 days ago | |
Go | Go | |
BSD 3-clause "New" or "Revised" License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
sh
-
Show HN: Hucksh – A Shell with a Good Memory
* The shell itself is https://github.com/mvdan/sh, a bash-like command interpreter
-
Pure Bash Bible
https://github.com/mvdan/sh
And finally, checkbashisms if you intend on making pure posix scripts that are compatible with debian/ubuntu's dash. It is part of the debian's devscripts suite, but is often individually packaged in other distros.
> Also you can use the chat as a learning tool
Or you could learn from a guide written by people who have suffered decades of experience of the pitfalls of shell scripting and have shared their woes.
-
Shfmt – format shell programs (like gofmt, rustfmt)
For the first two caveats, I actually agree that we could and should handle ambiguous input. It just hasn't been a priority because doing that properly would be quite a bit of work, and such ambiguous syntax isn't particularly common. See https://github.com/mvdan/sh/issues/686 for my current thoughts on how to tackle it.
The third caveat concerns parsing `export` and `let` as keywords rather than as builtins. Like the README says, this is to properly build the syntax without leaving opaque strings as expressions, but also to support `declare foo=(bar)` which wouldn't work if `declare` was treated like any other builtin simple command.
How else would you have a static parser handle these two builtins? They are in a bit of an awkward middle ground between builtin and keyword. My instinct is that giving them special treatment in the parser to allow tokens like `(`, while at the same time representing them in the syntax tree with opaque strings as expressions, would be pretty underwhelming to any users of the parser.
That said, we already have that problem with `let "foo=123"` for example, where our parser currently represents the expression as the quoted string without going any deeper. https://github.com/mvdan/sh/issues/754#issuecomment-96329574... considers doing a second parse stage in the shell interpreter to fix cases like these, though always doing a second parse could get expensive.
We _could_ leave all arithmetic expressions as input strings in the parser, and do all the actual parsing when they are evaluated. That would be more compatible with Bash and more consistent. But it would also be less useful to any parser users who don't run into any of these weird edge cases, which aren't common at all, I think.
In short, I have some ideas, but I'm not sure at all what's best :) Doing a good job for 99% of users feels better than aiming for 100% compatibility with bash syntax, particularly where bash syntax is a bit weird.
-
Gofumpt: It's like gofmt except more strict
My bad, I completely screwed this up... the as of yet undiscussed project is:
(not shmfmt)
-
Gosh Linux shell written in Golang
I support projects like this for purposes of exploration and practice. But don't expect people to use it when there are already well established projects out there like: https://github.com/mvdan/sh
-
similar to shellcheck?
There are also: - shfmt - sh - bash language server - bashate
-
Code formatter, linters, etc. Recommendations?
There is shellcheck, and shellharden which is a strict version of it. There are similar stuff here, some that also help with your editor. You can also use a docker version of shfmt. See here for a quick tutorial on shfmt.
-
First Bash Script
Now go ahead and install shellcheck and shfmt to get even better at it.
-
How can I fix this install script to detect archives, and what are the strange numbers for the permissions? Plz help me understand.
INSTALL_DIR=/usr/local/bin # Call with arguments (location,filename,sha,name,strip) function download_verify_install() { curl -LOf "${1}${2}" echo "${3} ./${2}" | sha512sum --check tar -C $INSTALL_DIR/ -xf "${2}" --no-anchored "${4}" --strip="${5}" } install_redhat_binaries() { BOLD=$(tput bold) RESET=$(tput sgr0) set -euo pipefail local PANDOC_LOCATION=https://github.com/jgm/pandoc/releases/download/2.11.2/ local PANDOC_FILENAME=pandoc-2.11.2-linux-amd64.tar.gz local PANDOC_SHA=9d265941f224d376514e18fc45d5292e9c2481b04693c96917a0d55ed817b190cf2ea2666097388bfdf30023db2628567ea04ff6b9cc3316130a8190da72c605 local SHELLCHECK_LOCATION=https://github.com/koalaman/shellcheck/releases/download/v0.7.2/ local SHELLCHECK_FILENAME=shellcheck-v0.7.2.linux.x86_64.tar.xz local SHELLCHECK_SHA=067e2b8ee1910218de1e62068f7cc86ed7048e97b2a9d7c475ea29ae81c17a944376ce5c240d5c783ef3251d9bee7d7d010351958314eadd0fc88b5decfd8328 local SHFMT_LOCATION=https://github.com/mvdan/sh/releases/download/v3.2.2/ local SHFMT_FILENAME=shfmt_v3.2.2_linux_amd64 local SHFMT_SHA=d4e699575899f7c44dbce54f6414fb63c0527e7d743ea724cb0091417e07a353c1d156d4184580a260ca855cdf5e01cdf46b353f04cf5093eba3ffc02223f1c6 local BAT_LOCATION=https://github.com/sharkdp/bat/releases/download/v0.18.1/ local BAT_FILENAME=bat-v0.18.1-x86_64-unknown-linux-gnu.tar.gz local BAT_SHA=5ccab17461d2c707dab2e917daacdabe744c8f8c1e09330c03f17b6f9a9be3d79d8a2786c5e37b1bdbdb981e9d9debfec909b4a99bf62329d6f12c1c3e8dfcb7 local RIPGREP_LOCATION=https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ local RIPGREP_FILENAME=ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz local RIPGREP_SHA=cdc18bd31019fc7b8509224c2f52b230be33dee36deea2e4db1ee8c78ace406c7cd182814d056f4ce65ee533290a674822432777b61c2b4bc8cc4a4ea107cfde echo -e "${BOLD}Installing binaries for RHEL clones not available in repositories...${RESET}\n" download_verify_install "$PANDOC_LOCATION" "$PANDOC_FILENAME" "$PANDOC_SHA" "pandoc" 2 download_verify_install "$SHELLCHECK_LOCATION" "$SHELLCHECK_FILENAME" "$SHELLCHECK_SHA" "shellcheck" 1 download_verify_install "$BAT_LOCATION" "$BAT_FILENAME" "$BAT_SHA" "bat" 1 download_verify_install "$RIPGREP_LOCATION" "$RIPGREP_FILENAME" "$RIPGREP_SHA" "rg" 1 # download_verify "$SHFMT_LOCATION" "$SHFMT_FILENAME" "$SHFMT_SHA" # chmod +x $SHFMT_FILENAME # mv $SHFMT_FILENAME $INSTALL_DIR/shfmt } install_redhat_binaries
efm-langserver
-
Style rules for LSP for coursework
Usually another program is used to lint/format code. Basic way is to just run them as a shell command or in another terminal and reload the file, but you can also hook it up to lsp. For example Javascript/Typescript projects use eslint and prettier. Runing `npx prettier` will format the files according to default rules. This is fine for every once in a while or a pre-commit hook. I think you are looking to have it integrated in nvim. Most formatters don't have a language server so you can connect them to nvim lsp with a general language server like: https://github.com/mattn/efm-langserver
-
How to setup efm-langserver for pint formatter?
I've been using pint for formatting php files with null-ls.nvim. Few days ago null-ls.nvim has announced that the plugin will be archived in few months so I started migrating all my formatters and linter from null-ls to efm-langserver. I got other things such as prettier, black, isort, mypy, etc. working but can't get pint to work with php files: If I run pint via efm-langserver, everything is deleted from the buffer, and the saved file is formatted separately. How do I setup efm-langserver correctly to work with pint? Below is my config.yml for pint currently. yaml tools: pint: &pint format-command: "pint --no-interaction --quiet ${INPUT}" format-stdin: false languages: php: - <<: *pint Thank you.
- null-ls will be archived
-
How do you handle level productivity: autoformat, insert debug statement, execute file?
I use the LSP if it supports formatting. I supplement that with efm-langserver which interfaces with CLI formatters and linters. It works well, similar to null-ls as I understand it.
-
Editing the same file in a split causes vim to jump to the top of the file when saving with autoformatter
As far as I know, the only solution (other than getting formatting directly from a LSP server) is to use EFM (https://github.com/mattn/efm-langserver), which implements the tricky logic of figuring out how to only update the changed text.
- Universal coc language server?
-
How to do syntax checking on languages that don't have an LSP server in neovim?
There's also efm which wraps linters into an LSP server which can then communicate with nvim.
-
What spell checker/correction are you using for neovim ?
Since I'm using efm-language server with configured `misspell tool. However, this just suggest the incorrect word for the buffer. I
-
What is the purpose of null-ls.nvim? I've read the README but I don't really understand what it gives me over a language server like clangd or jdtls, for example
Note that there are also other implementations of such a multipurpose language server like the efm-langserver. While efm works for any editor/tool that uses language servers, Null-ls is a optimized solution only for NeoVim.
-
how to conditionally allow efm to enable formatting
money! thank you for this. I was looking for answers [here](https://github.com/mattn/efm-langserver) , forgot about [this](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server\_configurations.md#efm)
What are some alternatives?
null-ls.nvim - Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
nvim-lspconfig - Quickstart configs for Nvim LSP
format.nvim - A wrapper around Neovims native LSP formatting. [Moved to: https://github.com/lukas-reineke/lsp-format.nvim]
diagnostic-languageserver - diagnostic language server integrate with linters
formatter.nvim
ShellCheck - ShellCheck, a static analysis tool for shell scripts
neoformat - :sparkles: A (Neo)vim plugin for formatting code.
nvim-ale-diagnostic - Display Neovim LSP diagnostics in ALE.
bat - A cat(1) clone with wings.
diagnosticls-configs-nvim - An unofficial collection of linters and formatters configured for diagnostic-languageserver for neovim.
prettier_d_slim