Comments (18)
Turns out you can!
My mistake is that I was doing lua require('otter').activate({'elixir'})
instead of lua require('otter').activate({'markdown'})
from otter.nvim.
Big up for the issue title! 🦦
from otter.nvim.
Just need a small fix here: e302002#r130924812
from otter.nvim.
Wrote about otter in Elixir Forum:
https://elixirforum.com/t/grammar-style-check-and-markdown-linter-for-code-documentation-in-neovim/59248
from otter.nvim.
Sorry to bump this again,
My markdown files are using ltex-ls and vale-ls.
In the markdown inside Elixir files, I got ltex-ls working, but only because it works with plaintext files (and then it gives me a lot of diagnostics that doesn't make sense in Markdown):
[ERROR][2023-10-24 18:24:23] .../vim/lsp/rpc.lua:675 "rpc" "ltex-ls" "stderr" "Oct 24, 2023 6:24:23 PM org.bsplines.ltexls.parsing.CodeFragmentizer$Companion create\nWARNING: Unsupported code language ID '', treating text as plaintext\n"
So it seems to me that otter is generating buffers with no filetype set. How can I debug it further? (I'm using Neovim nightly, btw)
from otter.nvim.
Indeed, for performance reasons I don't set the ft of the otter buffer:
otter.nvim/lua/otter/keeper.lua
Lines 238 to 249 in 374fcce
from otter.nvim.
So any languageserver configured to attach to the would-be-filtetype of the otter buffer should still be attached because lspconfig creates the autocommand whose callback we call here.
from otter.nvim.
So any languageserver configured to attach to the would-be-filtetype of the otter buffer should still be attached because lspconfig creates the autocommand whose callback we call here.
interesting!
I added some vim.inpects to see what's going on:
main_nr: 1
lang: "markdown"
otter_nr: 3
autocommands: { {
buflocal = false,
callback = <function 1>,
command = "",
desc = "Checks whether server marksman should start a new instance or attach to an existing one.",
event = "FileType",
group = 26,
group_name = "lspconfig",
id = 62,
once = false,
pattern = "markdown"
}, {
buflocal = false,
callback = <function 2>,
command = "",
desc = "Checks whether server vale_ls should start a new instance or attach to an existing one.",
event = "FileType",
group = 26,
group_name = "lspconfig",
id = 64,
once = false,
pattern = "markdown"
}, {
buflocal = false,
callback = <function 3>,
command = "",
desc = "Checks whether server ltex should start a new instance or attach to an existing one.",
event = "FileType",
group = 26,
group_name = "lspconfig",
id = 77,
once = false,
pattern = "markdown"
} }
diagnostics: true
But no luck with marksman and vale attaching to the otter buffer yet. Still investigating. If you have any pointers, please let me know.
from otter.nvim.
I guessing they are being attached and immediately quit because they require a filetype? Does the lsp log show something?
Maybe I can revert to setting the filetype instead of manually calling the callbacks. I believe I have since made other performance improvements that may make this "hack" obsolete.
Can you try this?
-- local autocommands = api.nvim_get_autocmds({ group = "lspconfig", pattern = lang })
-- for _, command in ipairs(autocommands) do
-- local opt = { buf = otter_nr }
-- command.callback(opt)
-- end
api.nvim_buf_set_option(otter_nr, "filetype", lang)
from otter.nvim.
Can you try this?
-- local autocommands = api.nvim_get_autocmds({ group = "lspconfig", pattern = lang }) -- for _, command in ipairs(autocommands) do -- local opt = { buf = otter_nr } -- command.callback(opt) -- end api.nvim_buf_set_option(otter_nr, "filetype", lang)
That worked for ltex-ls, which was already attaching to the otter buffer. Now ltex-ls parses it as a Markdown code correctly:
This is great already!
Now, I still wonder why the other LSPs are not attaching. In particular, I'm interested in vale-ls, but the lsp logs show nothing.
from otter.nvim.
Does vale attach correctly to regular markdown buffers?
from otter.nvim.
You can also directly open the otter buffer (:ls!
to see which number it has, then :b<number>
) and experiment in it.
from otter.nvim.
Does vale attach correctly to regular markdown buffers?
It does. But I managed to get everything working. My problem is that I had installed (through Mason) both vale
and vale-ls
. As soon as I uninstalled vale
, it worked as expected:
Now, I still need to set filetype for ltex-ls
in order to ignore some errors that don't make sense for Markdown, so that the final result is:
from otter.nvim.
Thanks a lot for helping me through it! I didn't know about ls!
, that was really helpful.
Are you going to reenable filetype? I guess it would only benefit users of ltex on embedded markdown, so, not sure if you want to go that path, although I'd be glad if you did :)
from otter.nvim.
I haven't found performance degradation from re-enabling filetypes on otter bufffers in my config so far, so I might. But I am wary about people's filetype plugins doing weird things to the otter buffers or running a lot more code than they have to. You know what, we can just leave both options in and make it configurable.
from otter.nvim.
the release bot misunderstood my refs
, was not supposed to close this. Let me know how this change works for you.
from otter.nvim.
Everything working perfectly (saw the new release)! Thanks again so much. And I apologize for all the trouble in helping me
from otter.nvim.
I thank you for your contribution! :)
from otter.nvim.
Related Issues (20)
- [bug]ask format eat some additional lines HOT 2
- Deprecated `vim.lsp.get_active_clients`
- attempt to call method '_rawquery' (a nil value) HOT 1
- Handle buffers without active raft more gracefully or provide a way to check whether a raft is registered HOT 3
- Installing quarto in Noevim produces multiple errors. HOT 5
- Rename doesn't work with dressing.nvim HOT 4
- Formatting Issues Using 'otter'.ask_format() in python HOT 6
- use Text Document Synchronization
- Broken syntax highlighting HOT 3
- Noice Issues After updating Otter.NVIM HOT 4
- feat: use lsp request params to determine position for language context
- fix: make completion more robust about restarting lsp servers
- pyright in otter buffer doesn't update when otter was activated from markdown main document HOT 15
- failed to run config for otter.nvim HOT 2
- Question/Help HOT 2
- bug: handle_leading_whitespace seems to delete all whitespace (?) HOT 12
- Add to mason? HOT 2
- Opening a blank file produces "Error requesting document symbols" HOT 28
- verbose.no_code_found = false does not work when entering buffer from a directory. HOT 3
- rewrite `config` to be more robust with lazy loading
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 otter.nvim.