feat: ls settings override.
closes #3 and #5
add basic settings support. update readme to show configuration. bump version to 0.0.5
usage:
"lsp": {
"harper-ls": {
"binary": {
"path": "/path/to/harper-ls" # if you wish to override else download automatically.
},
"settings": {
"harper-ls": {
"userDictPath": "~/dict.txt",
"fileDictPath": "~/.harper/",
"diagnosticSeverity": "hint", // hint, warning, error, information
"linters": {
"spell_check": true,
"spelled_numbers": true,
"an_a": true,
"sentence_capitalization": true,
"unclosed_quotes": true,
"wrong_quotes": false,
"long_sentences": true,
"repeated_words": true,
"spaces": true,
"matcher": true,
"correct_number_suffix": true,
"number_suffix_capitalization": true,
"multiple_sequential_pronouns": true,
"linking_verbs": false,
"avoid_curses": true,
"terminating_conjunctions": true
},
codeActions = {
forceStable = false // Force code actions to appear in "stable" positions
}
}
}
}
}
I'll try to pass a default config if none provided later, so that people won't be getting #5
Fixes now #5 too. We will now provide a barebones config if none is provided.
I think so far it looks good and does as much as we can without messing with harper source.
@jollywatt and/or @failable can you test this locally to verify it fixes your issues? I find it hard to reproduce the error myself, would prefer to have verification before releasing again.
You can clone this repo/PR and install it as a dev extension: https://zed.dev/docs/extensions/developing-extensions#developing-an-extension-locally
If I choose Install Dev Extension and select the repo directory, absolutely nothing happens. Do I have to build the extension locally first?
Edit: rustc is installed, but Zed emits the log message:
2024-11-25T15:44:23.663865Z [INFO] compiling Rust extension /Users/xxx/Documents/harper_zed
2024-11-25T15:44:23.664423Z [ERROR] failed to compile Rust extension
Caused by:
0: failed to run rustc
1: No such file or directory (os error 2)
Try to compile it locally First and then you will likely See what the error is. I suspect it might be a faulty or incomplete Installation?
Try to compile it against the wasm Target that zed uses:
cargo build --target wasm32-wasip1
@jollywatt and/or @failable can you test this locally to verify it fixes your issues? I find it hard to reproduce the error myself, would prefer to have verification before releasing again.
You can clone this repo/PR and install it as a dev extension: https://zed.dev/docs/extensions/developing-extensions#developing-an-extension-locally
Also, I had this error only similarly. The Harper-ls expects a config but it wasnt provided and it threw the error for me in the lsp logs, but it still worked? For me this made it dissapear,but like i Said it was the same message, but it didnt impact me.
harper_zed compiles fine locally, but Zed always gives the log error above. (Zed was freshly installed.)
harper_zed compiles fine locally, but Zed always gives the log error above. (Zed was freshly installed.)
Alright, Verify a couple of things for me please:
Rustup with all the necessary stuff has been installed and the appropriate Target works to compile locally even when deleting in the following files: .cargo folder rust-toolchain.toml
Maybe clone it again First. If that works, try to compile it as a dev extension in zed again.
A couple of things: On what Platform are you? What is your Zed Version? Does an older version of this repo work?
Do you start Zed from a menu launcher Like dmenu or rofi? (some guy has path issues there)
Also you might try this: https://stackoverflow.com/a/75676790/22845956
Hello, Any news on this? I'm OK to test but some pointer on how to woul be great :)
I'd like to have a "project" file per git repositories so we can make linting on PR also, do you think it would be feasible by configuring something like:
"lsp": {
"harper-ls": {
"settings": {
"harper-ls": {
"userDictPath": "./harper/accept.txt"
}
}
thanks !
I have not been able to get "Add to dictionary" Code Actions to appear using this fork as a dev extension.
I took a brief view of harper's LSP integration and my understanding is that the code action is not triggering based on harper's internal heuristics rather than configuration. This may be incorrect.
Has anyone else been able to configure dictionary additions via Code Actions (cc @nuIIpointerexception)
Any update on this? This is a critical feature that is a deal breaker for me as I can't change the dialect to British.
Yeah this would be super handy if it works, I am also :( at it suggesting yank spellings for everything.
closing, fixed in #10