Comments (9)
I used an autocmd to disable diagnostics in any buffer matching clojure-log-*
I assume something similar to disable Treesitter may be effective (but just a guess)
from conjure.
On LSP, the lspconfig plugin sets autocommands on FileType
to autostart servers. There is a catch for the buffer option buftype=nofile
, but for log buffers this looks like it's set after the autocmd fires.
I quickly hacked this together to demonstrate. nvim.fn.bufload
was setting the filetype, and I had to explicitly set the filetype after.
PaterJason@768580b#diff-e0903b23fec5b0ccc884fe0be027056d0a7bb5c55bb73ecc58a0d56377353811
from conjure.
Oh interesting! So maybe if I just change the order of the buftype setting it'd help some people out. I kind of like the LSP / linting in the log buffer because it helps me autocomplete, doc lookup and edit the contents in the same way as I would a normal buffer.
I get that some people wouldn't want that but this is why I opted (in the past) to say "disable it yourself" rather than disabling it by default in such a way that people couldn't turn it back on.
If I change the order and set buftype before the autocmd fires, I guess it turns off LSP for the log buffer? (in theory)
In doing so, do I remove the ability for anyone to use LSP in the log without some hacking? Is there an easy way to then selectively turn it on for the users that do want the log to have LSP?
Maybe if nofile
doesn't really do much for us (I feel like it does?) we could move it so it's set at the right time and then make it optional so people can ignore the nofile option, thus kinda making an LSP toggle, although an indirect one.
Of course this behaviour will change / break if the plugins we're trying to toggle change their behaviour. Which is another reason I never wanted to do this from Conjure's side. Conjure makes a Clojure buffer, your plugins hook into that buffer, I mostly feel like it's the duty of those plugins to be easily configurable to NOT fire for some buffers or patterns and I shouldn't try to actively block plugins from hooking into the log buffer since there could be infinitely many plugins and they may change behaviour from under me.
So I'm not 100% settled on the way forward yet, but this is really interesting information and I'd like to find a solution that keeps both camps happier for the long term (people who want linting in the log and people who don't).
from conjure.
One thing to note here is that there are really two different kinds of Clojure: one that you might see in a source file, and one that you see in a REPL (or the log buffer). As a quick example, here's what I see when I evaluate a simple source file:
clojure-lsp
understands the source file, but it doesn't seem to really understand the log buffer. This is the type of diagnostic warning that I was looking to avoid, since evaluating larger files results in the log buffer filling up with errors.
So, one possible solution for me would be to somehow tell clojure-lsp
that the log buffer should be evaluated within the context of the project, rather than as a standalone file. I'm not sure if that's possible, but it would be nice to keep LSP and diagnostics enabled if they can actually be useful.
from conjure.
Having a look, lspconfig doesn't want to attach at all to nofile
buffers, using either :LspStart
or the autostart. Stopping and starting wouldn't attach to an open log buffer for example. Which makes sense, a nofile
is not really part of the workspace. You can force it by starting the server using the builtin lua, which is relatively simple nowadays.
vim.lsp.start({
name = "clojure_lsp",
cmd = { "clojure-lsp" },
root_dir = vim.fs.root(
0,
{ "project.clj", "deps.edn", "build.boot", "shadow-cljs.edn", ".git", "bb.edn" }
),
})
And trigger that by autocmd. But if you wanted to do that for each filetype I can see it being a pain.
Personally I'd set the buffer options before FileType
autocmds, cos setting it after would potentially circumvent the intent in the lspconfig or other plugin/config.
from conjure.
Related Issues (20)
- Cannot connect to Scheme through socket HOT 2
- Async/await doesn't work with ipython REPL HOT 13
- stdio repl handling of both stderr and stdout for a form can be a problem sometimes HOT 1
- <localleader>ee, <localleader>E evaluate the whole file HOT 9
- Problems with evaluation: wrong returns HOT 3
- Guile over nREPL, guile-ares-rs integration HOT 4
- Clojure Debugger: Evaluation failing on debug reader tags HOT 4
- Local leader key not active when open scm files HOT 7
- Common-Lisp: Only first expression is evaluated using ConjureEvalBuf HOT 19
- Feature request: Re-run last test HOT 2
- Disable ConjureOmnifunc for Janet? HOT 4
- Common Lisp/ros/swank not behaving as expected HOT 15
- No syntax highlighting in log buffer when opening file using telescope. HOT 7
- HUD not popping up when using AstroVim HOT 3
- Adapt `IRust` support HOT 5
- Hy client not showing output HOT 5
- Clojure REPL in async environments does not eval output HOT 3
- Add highlighting to indicate which forms have not been changed since their last evaluation HOT 1
- Support clj-reload as well as tools.namespace reload since it's now built into nREPL
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conjure.