Getting Python Autocomplete
I use python to help collect some high-level commands, such as in my SAT solver. I’ve said previously that I don’t want to use nvim as an IDE, but I do want lots of nice features. (So by “not an IDE” I mean not really do much for file-exploring, git(hub) integration, etc: the tools are only to help edit text, leaving other more focused tools to do their thing.)
There’s syntax highlighting, linting, autoformatting, and autocomplete stuff. To my mind these are just examples of supporting a language, but apparently in nvim they’re all sort of different components. I followed along this nice video to get started (in a lot of ways; the language support is later, and to be clear I recommend this video a lot) but the pieces involved get a bit silly. As I get more plugged into the nvim world maybe this will feel better, but until then…
- I had to choose a plugin manager. Apparently lazy is the new hotness, though the purported lazy-loading seems never to be used?
- NVim supports the LSP, which is the root of all this functionality, but apparently there’s also a separate plugin you need to “really” use it?
- My impression is that NVim is an LSP client, but you still need per-language servers, which are separate executables (!, but fine…) for which you need another layer of package-manager-recursion: Mason.
- For auto-formatting (which is nice) one recommends this server, which is integrated with this plugin.
- Using pyright apparently required some treesitter stuff (a dimension to all this I haven’t really explored!), which ultimately meant I had to download and install npm, and futz with my path, and then I think everything sort of worked.
- Well I needed to do something with nvm-cmp too.
I think there were a few more steps, but I hope this speaks to the number of discrete components I had to futz with. I see the appeal of pre-made distributions like LazyVim.
Can This Be Easier?
I have some familiarity with implementing language tooling. I’m reasonably confident with what’s happening here: people have managed to factor the “incremental-compilation” aspect of IDEs into this LSP language, and that allows for modularity: any language developer can implement an LSP server and it can provide some amount of information to clients. The functionality to consume that information is itself separate: so far it seems like theres’: [LanguageServer]->[Client(Neovim)]->[Tool(AutoComplete plugin)] or something. I suppose this allows users to, e.g., define their own hotkeys for the single autocomplete tool, and have that intelligently consume the LSP information for any language, which is neat.
I believe that the components here have a reasoning behind them, but I think their presentation would be better served by having a few minutes saying why this is the way it is (versus, say, a Python plugin that has all the options you want, a C++ plugin that has all the options you want, etc…). Having to go to 3 different plugins or whatever, and manually install third-party tools (even if there’s a plugin that does that installation for you!) is, to my mind, not ideal.