This is a work-in-progress PR to add the LSP plugin. There are still some things missing like the documentation but in general the plugin should work. There are 3 modes of operation:
1. Without Geany LSP support 2. With basic LSP support using https://github.com/geany/geany/pull/3849 3. With full LSP support using https://github.com/geany/geany/pull/3850
The plugin should detect with which of these modes Geany was compiled and adjust itself automatically.
For the time being I still plan continue the main development of the plugin under https://github.com/techee/geany-lsp and sync the changes here from time to time. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany-plugins/pull/1331
-- Commit Summary --
* Add LSP plugin
-- File Changes --
M Makefile.am (4) M build/geany-plugins.nsi (1) A build/lsp.m4 (10) M configure.ac (1) A lsp/AUTHORS (1) A lsp/COPYING (340) A lsp/ChangeLog (0) A lsp/Makefile.am (4) A lsp/NEWS (0) A lsp/README (0) A lsp/data/Makefile.am (5) A lsp/data/lsp.conf (102) A lsp/src/Makefile.am (119) A lsp/src/json-glib/json-array.c (838) A lsp/src/json-glib/json-builder.c (845) A lsp/src/json-glib/json-builder.h (108) A lsp/src/json-glib/json-debug.c (38) A lsp/src/json-glib/json-debug.h (51) A lsp/src/json-glib/json-enum-types.c (123) A lsp/src/json-glib/json-enum-types.h (33) A lsp/src/json-glib/json-gboxed.c (301) A lsp/src/json-glib/json-generator.c (807) A lsp/src/json-glib/json-generator.h (113) A lsp/src/json-glib/json-glib.h (44) A lsp/src/json-glib/json-gobject-private.h (36) A lsp/src/json-glib/json-gobject.c (1005) A lsp/src/json-glib/json-gobject.h (250) A lsp/src/json-glib/json-gvariant.c (1346) A lsp/src/json-glib/json-gvariant.h (50) A lsp/src/json-glib/json-node.c (1555) A lsp/src/json-glib/json-object.c (1261) A lsp/src/json-glib/json-parser.c (1707) A lsp/src/json-glib/json-parser.h (244) A lsp/src/json-glib/json-path.c (998) A lsp/src/json-glib/json-path.h (88) A lsp/src/json-glib/json-reader.c (1138) A lsp/src/json-glib/json-reader.h (161) A lsp/src/json-glib/json-scanner.c (1371) A lsp/src/json-glib/json-scanner.h (120) A lsp/src/json-glib/json-serializable.c (386) A lsp/src/json-glib/json-types-private.h (185) A lsp/src/json-glib/json-types.h (534) A lsp/src/json-glib/json-utils.c (95) A lsp/src/json-glib/json-utils.h (37) A lsp/src/json-glib/json-value.c (280) A lsp/src/json-glib/json-version-macros.h (261) A lsp/src/json-glib/json-version.h (100) A lsp/src/jsonrpc-glib/jsonrpc-client.c (1752) A lsp/src/jsonrpc-glib/jsonrpc-client.h (165) A lsp/src/jsonrpc-glib/jsonrpc-glib.h (39) A lsp/src/jsonrpc-glib/jsonrpc-input-stream-private.h (30) A lsp/src/jsonrpc-glib/jsonrpc-input-stream.c (398) A lsp/src/jsonrpc-glib/jsonrpc-input-stream.h (67) A lsp/src/jsonrpc-glib/jsonrpc-marshalers.c (0) A lsp/src/jsonrpc-glib/jsonrpc-marshalers.h (0) A lsp/src/jsonrpc-glib/jsonrpc-message.c (0) A lsp/src/jsonrpc-glib/jsonrpc-message.h (0) A lsp/src/jsonrpc-glib/jsonrpc-output-stream.c (0) A lsp/src/jsonrpc-glib/jsonrpc-output-stream.h (0) A lsp/src/jsonrpc-glib/jsonrpc-server.c (0) A lsp/src/jsonrpc-glib/jsonrpc-server.h (0) A lsp/src/jsonrpc-glib/jsonrpc-version-macros.h (0) A lsp/src/jsonrpc-glib/jsonrpc-version.h (0) A lsp/src/lsp-autocomplete.c (0) A lsp/src/lsp-autocomplete.h (0) A lsp/src/lsp-code-lens.c (0) A lsp/src/lsp-code-lens.h (0) A lsp/src/lsp-command.c (0) A lsp/src/lsp-command.h (0) A lsp/src/lsp-diagnostics.c (0) A lsp/src/lsp-diagnostics.h (0) A lsp/src/lsp-format.c (0) A lsp/src/lsp-format.h (0) A lsp/src/lsp-goto-anywhere.c (0) A lsp/src/lsp-goto-anywhere.h (0) A lsp/src/lsp-goto-panel.c (0) A lsp/src/lsp-goto-panel.h (0) A lsp/src/lsp-goto.c (0) A lsp/src/lsp-goto.h (0) A lsp/src/lsp-highlight.c (0) A lsp/src/lsp-highlight.h (0) A lsp/src/lsp-hover.c (0) A lsp/src/lsp-hover.h (0) A lsp/src/lsp-log.c (0) A lsp/src/lsp-log.h (0) A lsp/src/lsp-main.c (0) A lsp/src/lsp-progress.c (0) A lsp/src/lsp-progress.h (0) A lsp/src/lsp-rename.c (0) A lsp/src/lsp-rename.h (0) A lsp/src/lsp-rpc.c (0) A lsp/src/lsp-rpc.h (0) A lsp/src/lsp-semtokens.c (0) A lsp/src/lsp-semtokens.h (0) A lsp/src/lsp-server.c (0) A lsp/src/lsp-server.h (0) A lsp/src/lsp-signature.c (0) A lsp/src/lsp-signature.h (0) A lsp/src/lsp-symbol-kinds.c (0) A lsp/src/lsp-symbol-kinds.h (0) A lsp/src/lsp-symbol.c (0) A lsp/src/lsp-symbol.h (0) A lsp/src/lsp-symbols.c (0) A lsp/src/lsp-symbols.h (0) A lsp/src/lsp-sync.c (0) A lsp/src/lsp-sync.h (0) A lsp/src/lsp-utils.c (0) A lsp/src/lsp-utils.h (0)
-- Patch Links --
https://github.com/geany/geany-plugins/pull/1331.patch https://github.com/geany/geany-plugins/pull/1331.diff
@techee pushed 1 commit.
d66f8e6081c2ef3a10bd7dc5c01054ccf149a699 Check glib version for function availability
@techee pushed 1 commit.
4eef8fc8d81cf4c43139a3b16979037b6f5cae60 Add LSP plugin files to POTFILES.in
@techee pushed 4 commits.
5927a2d03d773173f5927c167dba021f24ec435e Move json and jsonrpc libraries to a separate directory 609db8491771845e8263e2381ab96c3acbd5a65f Don't use ifdef within a macro da340f53c5b1214defafd68f9f9c771317e6ba95 Don't send SIGTERM on Windows where sending signals is not supported 0334e01639ca699f244b96007274964db4f53419 Ignore json-glib for localizations
@techee pushed 10 commits.
92d117dc42acc8da0ff9b07f5eef99413ea74aea Add lsp to README 44bda83eb5dbca8c71c0203afe9ebc174c625083 Properly document the config file and rename 2 config options 0c486a569784822f275b4eac1806a7d510dcfc66 Fix location of global config file when using geany-plugins 8598056764a45d30d84a1036ff9fdd246132bcf6 Adjust for compiling both with geany-plugins and the combined geany-lsp project 18065eaa5e324a9b58cb943225c4797c494f8ebb Make sure menu items get correctly enabled/disabled based on server capabilities 430970538ff3799e9fcd935e538c06b04a02d896 Use correct URL for documentation 9e7b03612dec80250cece20760d0a732d441581d Use the definition of PLUGIN from geany-plugins d4a9a48c782745093204a0b0a77b3a065a0c9b5c Make some more strings translatable 0a85fc10fbeea0c751aeacccaa9286addfa27c04 Fix possible dereferencing of NULL pointer 59dd55a2dfa04412f45837b14b726de3ff20045b Make highlighted symbol slightly more light
@techee pushed 6 commits.
b3df23d328f504752688a6fb5c45beaa1447f1ab Add some GeanyDocument validity checks 4229993c86319ba4479dd289a2b0ee7ac0f4cf35 Make sure cached diagnostics and semantic tokens are cleared when document closed fbf54ff4305b677bbbb87fc6f377d0576ab62836 Make semantic tokens a little more robust against unexpected server values e43cf6ab59874417f726765f7c83cb7ba9126595 Fix goto document symbol de326e727106fa2702a2b031ca3dbc6151c3f77e Re-highlight symbols after performing a rename 0e90acb5d58649780dfe324fc104b4d38e8000ea Improve the global config file documentation
@techee pushed 8 commits.
66e82da94f5b3a718a383f2bee80a7ede3137a50 Make sure menu gets updated whhen closing the last document ced8d1717dbc6db861f3824125897774c885d70b Fix semantic token flickering when LSP server sends incorrect delta value 17b29d78efe1a41309130ab5f2da24265bb86554 Some small fixes related to document_get_current() == NULL 19fac74e645bd466bac123fa8005c0200b5043c2 Formatting 012c850ef6bda187379692af1487c056a96dd8e9 Fix lookup function being called before initialized in on_entry_text_notify() 90f814855a178822857d0f14b6b472aaa83bc343 Slightly optimize lsp_goto_panel_show() 10fc11798b9309b8cb6b3aa2bb5d81f2c57cfeb0 Add documentation 749ac83c76459735f6d75efb3da53472f0e28c7c Add a note about restarting the server
@frlan @b4n @eht16 The major things are "finished" from my perspective. If I missed something that needs to be done regarding geany-plugins integration, please let me know.
The word "finished" above means the plugin works but soft-depends on some things which are not in Geany yet, it's:
* https://github.com/geany/geany/pull/3707 (but I think this one isn't necessary if https://github.com/geany/geany/issues/3684 is properly fixed and one can be sure that the "document-activate" is fired) * https://github.com/geany/geany/pull/3572
The missing signals cause some warnings when started from the command-line.
Also, having some official support for LSP in Geany like https://github.com/geany/geany/pull/3849 would improve the user-friendliness and usefulness of the plugin.
I also plan to perform some more testing of the plugin and fix possible bugs but this should be independent of the string freeze if we want to make a Geany release soon.
@techee pushed 1 commit.
a0e0fded5093e77d9b73cce0f304e91b2fc30f34 Drop the usage of session-opening signal
@techee pushed 1 commit.
884c520b0781945d67603a036215e62f7c3d3c21 Fix cppcheck warnings
@techee pushed 2 commits.
eaa76c7e6eef919509857b9776e5338fa53c11ce Create lsp_utils_doc_is_valid() helper function 731a0f3060837a26afc183e57da1897dff366795 Perform expensive operations in idle callback after some timeout
@techee pushed 1 commit.
df2a325fd0d0aeaff1bde339a1bf36c1ac6d4053 Prefer autocomplete when both autocomplete and calltips are available
@techee pushed 2 commits.
aa62690507cbbc5d194d739097c02d0ad4305be0 Force-kill LSP server if normal shutdown unsuccessful eb5a7491b713105d6eb211f90f4d745cc14cc1ae Unref should close the stream so remove the todo comment
@techee pushed 1 commit.
2a9118b60c64283701a641764284b32915f1fd40 Allow disabling diagnostic messages only for some files
@techee pushed 1 commit.
cf1c68e80508f5f4fe1eb33c4e932ce49e7d8144 Fix memory leak
@techee pushed 2 commits.
4e6be72aa9980fac5e51d7456e5177de3e7fc22f Add some sanity checks d9668e7a8fee51bf99109e740b102328467ba299 Fix some more leaks
@techee pushed 1 commit.
fe72e17aa9cf198a15df0208e6d8dff0da718a16 Implement non-standard clangd LSP extension textDocument/switchSourceHeader
@techee pushed 1 commit.
7794a3f9a6f2e18293ddc78993a00e54b2afdafc Fix compilation with the combined geany-lsp repo
@techee pushed 4 commits.
0e2b0bd8d8008fc4a89b04c9d2e0720636e2de22 Fix runtime warning 86bfa0668fca887f6f277d0a5217a2bb78c84f50 Allow specifying JSON for initialization and formatting directly in the config file 19a425916a20c4ea1dddd50216bc91d6ed899d62 Add config option enabling/disabling project LSP use by default 95f44a488774170baaa3d40ab41092d52c8edfd9 Minor config file updates
@techee pushed 1 commit.
98329cc3f9f49c70cb63938625f5581f9cc44a2c Improve initial experience when using the plugin
@techee pushed 1 commit.
da98abcd538db01d0740e326ab0b2a0367e3a7d9 Some clarifications in the config file
@b4n Ping :-)
I think I'm pretty much done with the plugin and I'd like some feedback. I tried to address most of the complaints you had in https://github.com/geany/geany/pull/3571#issuecomment-1817205646:
The config file now contains these settings with these default values: ```ini # Defines whether the plugin should be enabled automatically for new or existing # projects (that have not yet been configured to use LSP). This configuration # is only valid in the [all] section enable_by_default=false # Defines whether the server should be used when no project is open. Servers # may not work correctly without a project because most of them need to know # the path to the project directory which corresponds to the path defined under # Project->Properties->Base path use_without_project=false # Defines whether the server should be used for files whose path is not within # the project directory use_outside_project_dir=false ```
This means that unless you explicitly enable LSP for the project, it isn't used. Similarly, files outside the project directory or plain non-project Geany use TM by default. No LSP unless you enable it.
On the other hand, I disagree there should be a fallback to TM when e.g. clangd isn't installed but LSP is enabled for the project - in this case it should be pretty clear something is wrong and falling back to TM would just hide the real problem.
I don't think clangd will ever work without a project - it really just compiles it behind the scenes - so testing it on individual files won't work and better to use TM for those.
I added ```ini # Semicolon-separated glob patterns specifying files for which diagnostic # messages are not shown. Useful when the server has a problem with some files diagnostics_disable_for=*/scintilla/*/*.h ``` config option so diagnostic messages can be disabled for some files like the Scintilla headers (apart from diagnostic messages I believe other things work fine also for these headers).
This PR allows using the plugin without any Geany support but IMO this sucks. One has to disable TM parsing in filetype configuration and then it's all or nothing, one cannot use e.g. one feature using TM and one using LSP or one project (or just single file) using TM (without having to change the configuration). I'm still hoping we find some API that is acceptable for everyone, see https://github.com/geany/geany/pull/3849 for my current proposal.
So when testing, I still recommend using the combined https://github.com/techee/geany-lsp repository.
Also, when trying the plugin, please delete `~/.config/geany/plugins/lsp/lsp.conf` first - I made some changes to the config file and the previous version will be incompatible.
I don't think clangd will ever work without a project - it really just compiles it behind the scenes - so testing it on individual files won't work and better to use TM for those.
Well, although in theory it is possible to not have `compile_commands.json` but really clangd is a pain without, so not only will it not work on isolated files, it won't work on any build system that doesn't make a `compile_commands.json` like Meson, Cmake, or other modern ones do automatically. For others use of [bear](https://github.com/rizsotto/Bear) is supposedly possible.
So the restrictions of the default settings seems fine.
Just to confirm geany-lsp is Geany with #3849 and this plugin, all previous versions removed? If so I think I'll just get a new clone [end lazy git user] :-)
As I said elsewhere I am running behind in getting to be able to try these, but real "soon" now I hope.
Signed not-b4n :-)
Just to confirm geany-lsp is Geany with #3849 and this plugin, all previous versions removed? If so I think I'll just get a new clone [end lazy git user] :-)
It's: 1. Geany 2. This PR 3. [#3850](https://github.com/geany/geany/pull/3850), i.e. including the symbol tree patches. But you can easily simulate https://github.com/geany/geany/pull/3849 by setting `document_symbols_enable=false` 4. https://github.com/geany/geany/pull/3870 5. The patch from https://sourceforge.net/p/scintilla/bugs/2403/ which is merged upstream and we can either get it by updating Scintilla or backporting to Geany (just a few lines of code)
@techee pushed 1 commit.
a808e99dd4459a3aba72f3a19933bbb26089c111 Update config options for pylsp
Does it include #3865?
@techee pushed 3 commits.
9437ee8d606c63b54aa3997d9392949e27283cc0 Fix semantic tokens not highlighted when LSP enabled for the first time 178d7fd616d5771b68654c7aa5154bb161823da5 Properly initialize project configuration 5315ffd94a780ed05f57c3f51aab3f84fef02830 Fix some warnings when using gopls
Does it include #3865?
No, it doesn't, but you don't need to disable the ctags parser for geany-lsp as it contains the proper LSP interface.
@techee pushed 15 commits.
353ef56e28d473377ebdde8dd3fad2eccdcb4776 Support CodeAction structs when performing commands and related fixes 5d7193fe0affe39d813093dca4a7432722216634 Support automatic code formatting on save ad09e3f8f027b65fcd9dab15f7a071155b110749 Workaround semantic token bug in gopls 805bbe2393a66f373a44762bbcbff2f65887b89f Improve semantic token support f86cb91bb635beaf246c55acbc2d7bceddcd6708 Various code lens and commands fixes e375d849a5722b93de672333078c7f55fc77aba4 Some fixes related to code lens styling 204736886384faa7eb2a53902ace239810386dea Add TODO bc5787ac986c28b2471915737dc9c27efaa48892 Don't save document when applying workspace edit 48e3ab6f30ab5b361a16188764fdde7fe98af8c8 Implement code action execution on save d67ae647966d54a401112d2b41e4df613fae222e Implement command keybindings 2b5cf4bbbbd5518540e8721d55e5acaf3b59815b Use regexes for on-save commands instead of glob patterns a67eeb90cf73f9f71f9a371a1341b1b1d077abad Allow adding keybindings also for code lenses eddd9151b1ef031c6dbdd8f4c08410a9d23dfc0f Fix problems when saving multiple files for which code actions are 670120176e2269aec45bbfaad9ee49da07dc374b Fix code action position 752bad781fad87598b74b0b4ae83c8e07eeeb91f Fix crash by preserving code action commands until next call
@techee pushed 1 commit.
514e8d61a4a141f0ddc1c6fa2de15f28cac8cbc7 Remove invalid settings for gopls
@techee pushed 6 commits.
b4427b4b27d26024168d23aa224fa39bc6a805e3 Sort autocomplete list so that the symbols whose prefix was typed are first fa0eb50cae7cc35cfae42212ac2e06425b78027b Fix some runtime warnings when empty unsaved file is shown b28567712e2a3fd90f3ffceb80b95f8cce700eaa Add basic rust configuration 52581d38930958c816ba39fefe83c1bcdaec9dd2 Add logging for arguments sent as a reply to a server request 98d714bf3f98babcf5651032316adebeb8b714ca Fix some autocompletion sorting problems c4ddf2892f97b4ba3e6a353fba9842ce021c0fe9 Support autocompletion context
@techee pushed 6 commits.
aa11c417ed4d6a3b440916b8d87e50ad6192a9dd Add includeDeclaration parameter to textDocument/references 1733e8aee7e0422e8b74f874186f289e78738bc3 Semantic tokens: don't require resultId 4820b29b7728aaef1c2226873c2e0262c9d784dc Fix calltip code when the string starts with \n 9802fb6e5533f1ae2e6dc159d71544fb54efb500 Don't show a popup when server crashes too often a44cb99f2ad72107c4af43ba3e43e7ca8c5cf986 Don't request server launch on hover 1617bc1e2dfe1a8248e8a138bebb9977ce333441 Add typescript-language-server configuration
@techee pushed 8 commits.
de56e6fca884cc822a8d5a25b94f942de8666557 Move formatting options to the [all] section so there are some defaults 7a9cda00abcbdfc21599ebab01ed0a6e13320cf3 Add haskell server specific hack 20a158c662d453d7f64fea4f67f6100225dfb2b7 tmp 73811aa92846cc6a24bb2dd8277198af968889a9 Add rootUri in the initialize request which is required by the haskell server 1f75d3a9fa7bb8fb8a39abdcdc6f0343af736b2c Announce autocompletion context support 0e8bdc492642e2facde90c11b7afed550378a3bb Make the plugin more robust in case of unexpected server terminations da9ed23575e0d288cf1ba81cdfaf6e65c5e281b4 Allow to configure "full" semantic tokens to be always used 84641c76323eb280024d3d8b86b34fb545cf3735 Add working configuration for Haskell language server
@techee pushed 2 commits.
f0ae1e3b1e52acf676ff6061762b4dc66497aa30 Update menu sensitivity after creating menu items 90cbe4e6b5ab669e36d011dbd66679f12920e6f1 Add Swift language server configuration
@techee pushed 4 commits.
206318f00881bd8487a2045913c3a5194f721101 Don't show snippets in autocompletion list as they are not supported 57e39f1ebf1b80dcaacaca8bc560b96fb0d1cddc Support direct CompletionItem array in addition to CompletionList 757d342e359fd83a0aae2860f201283d57e41f88 Fix incorrect handling of full document sync (used by bash-language-server) 338a75250a6201f4d2508e107bd34816df073efc Add bash-language-server configuration
@techee pushed 14 commits.
c3968b012f697a65312e9871c3fbdca12c31374d Add phpactor configuration bad4fab3e37d2f3d852879f02601af5d268175db Always update last context menu click position f533b000019136b99ea527b2712d60547e1ba1af Rename "Rename in File" to "Rename Highlighted" which is more descriptive ae9821f6a72eca3154953f47b8317a6984d03ced Add Latex configuration, drop Swift macOS configuration bbe28fa1d0a7a31a1a07d82681f36d6289d59830 Add configuration for Ruby 5453321258033dec5a80d1df9860d55bd5d8e043 Don't retry server restarts if the server fails to launch ba1454793eebd74cfb1a50d782cc3dbca6605199 Call on_document_visible() in plugin_init() a4586328fb0f893a75a1fdd0ba7cb8ef9a3cd896 Fix some LSP server process management issues bfc6c410ced026f308f85a2264bca50a46c3b794 Update formatting in lsp.conf 9e64bd1b5c3838c3574cb5329f6eb1361369b3ec Add keybinding for showing diagnostic messages 45064cf278538e5a06402eae6d0af44662035c08 Configure pyright instead of pylsp by default 4432bdbc9a5e7470eb2517273fb1b7d2a1599d29 Remove retry loops as there's now the on_server_initialized() callback which can be used 5a3574cb5927ad7d16f3690892ba3d04784298c1 Add an "just in case" server kill 74dacc9b6261a4f34739403ce35669f583b5dc9f Use G_SOURCE_REMOVE for better clarity
@techee pushed 3 commits.
6b02c53465e890620b03a0c6a7a040cb42b477fb Use DOC_VALID() instead of its custom version 0bfd21fd5139b3e252fdf7a1e019ce9154046154 Fix initialize request for workspace folders when no project open c98a1496ecf4433bad7f1cd5b86492bf3d3ae218 Support multiple workspace folders configured by new project_root_marker_patterns settings
@techee pushed 1 commit.
d25253a1df3a961b910ef5877b2a4964137137de Fix memory leak
@b4n I added this feature to the plugin that other LSP clients implement as well (not tested much yet):
https://github.com/techee/geany-lsp/blob/c56de66cecf4dff2c1b1a98ea37b22bd2af...
This should essentially allow automatic opening/closing of multiple projects even if no Geany project is open and at least partially fix the problem you had when opening random files.
@techee pushed 1 commit.
99e86a3d6d28371f0a573e83e541bc1151112f6c Switch to the newly proposed plugin extension API
@techee pushed 2 commits.
d50c6c64b39cdb86ceb53fed1af717689fb5792e Reduce the number of lsp_utils_doc_ft_has_tags() calls in on_editor_notify() 78a2cd6b62643d53deb876b1e8bf6a9d60128d30 Make progress reporting configurable
@techee pushed 1 commit.
ad82d3c9c3a0604082cf208379b53c620791127c Add LSP plugin
@techee pushed 1 commit.
5fba42b151a2385651095887864cb18176fa406f Add LSP plugin
@techee pushed 1 commit.
831c3ac506888d2ff7485bd3eae4022f622b901f Add LSP plugin
Alright, I've pushed the latest version here with squashed commits. Apart from bugfixes (if some bugs appear), I don't plan anything more for this release.
Please let me know what needs to be done to get the plugin merged to geany-plugins.
Please let me know what needs to be done to get the plugin merged to geany-plugins.
Good question, plugins maintainer was @frlan but he hasn't been around much so I'm not sure if he doesn't have time any more. So somebody else maybe, @b4n, @eht16 ?
@techee pushed 1 commit.
55232c5c44a2a5d1e43b82eb0ee1a9fe8467aa0b Backport fixes from the geany-lsp project
I will *not* do a code review but I intend to use the plugin with my work project which has a huge Python code base and I'm very curious how it will work and maybe I'm going to switch to the LSP approach completely but no promises yet :).
Though this might take a few weeks to complete as I need to get in touch with LSPs and find my way through the config. But I already like a lot that the config file is well documented!
I will not do a code review but I intend to use the plugin with my work project which has a huge Python code base and I'm very curious how it will work and maybe I'm going to switch to the LSP approach completely but no promises yet :).
I'm _really_ interested in your feedback - some things may just be limitations of particular servers but some things can possibly be improved in the behavior of the plugin or new config options could possibly be added to control the plugin's behavior if some servers behave differently.
I mostly tested the plugin with the `clangd` server and not so much with Python and other pre-configured servers which I tested only lightly. I found `pylsp` a little too slow so I'd recommend `pyright` or `jedi-language-server`. If you only want to use a linting language server, `ruff` might be a good option as it's super-fast. There has been some discussion about various Python language servers in
https://github.com/techee/geany-lsp/issues/51
Also, it's always possible to disable a particular feature and fall back to Geany's default TM implementation.
Though this might take a few weeks to complete as I need to get in touch with LSPs and find my way through the config.
It's actually really simple and you don't have to study anything too much. Just install the server you want to use, check its documentation regarding how to start it and whether it needs some special command-line options and enter this to the `cmd` config file option. Then just follow
https://github.com/techee/geany-lsp?tab=readme-ov-file#quick-start
Some servers require the project's root directory, some don't. There are some options at the beginning of the config file you can use to configure the plugin so it runs without Geany projects if you don't want to use those.
Also, I recommend getting the plugin from https://github.com/techee/geany-lsp and not this PR as I still keep working on some stuff and sync the changes to this PR infrequently.
Alright, I got some more experience with python language servers while developing
https://github.com/techee/lsp-proxy
1. I don't like `pylsp` much - seems slow and kind of buggy 2. `pyright-langserver` seems to be very good but requires type annotations, otherwise it tends to report false positive errors - but I'm sure this is possible to configure by a config file where it should be possible to specify a less strict behavior. 3. `jedi-language-server` also seems to be good - it doesn't do such an advanced type analysis as pyright but on the other hand it doesn't suffer from false positives because of this 4. `ruff` is super fast, usable just for linting and can be a good supplemental language server to one of the three servers above - using multiple servers can be achieved by the `lsp-proxy` project above
The difference between 2 and 3 can be seen in code like ```Python foo = "" bar = foo + 1 ``` where `pyright` reports an error about adding a string and a number while `jedi-language-server` doesn't report anything.
@techee Also wanted to add some info about python's lsp
``` autocompletion linter/formatter type checker refactoring language pylsp V(jedi) V(ruff) V(mypy) V(rope,advanced) python jedi-language-server V(jedi) - - V python ruff server - V(ruff) - - rust pyright V - V V python/typescript pylyzer V - V V rust
Type checkers are lsp server mypy (python community) - seems most feature rich pytype (google) - can work with code without annotations pyright (microsoft) V up to 3x to 5x faster than mypy pyre (facebook and instagram) V pylyzer (rust) V up to 100x faster than pytype and pyright ```
I like very much jedi-language-server with ruff server (NOT ruff-lsp - this will be deprecated and written in python) More info about ruff server: https://astral.sh/blog/ruff-v0.4.5
Have tried this with some C++ with clangd and very limited Python pyright/pylsp. I havn't tried any other languages.
Nothing has crashed or atrocious behaviour. The servers themselves have various annoying behaviours, but thats not part of this plugin AFAIK.
One problem is it needs to try to switch to using `json-glib` and `jsonrpc-glib` as dependency packages not included source code. I will note some distros (I suspect Debian for eg) will require that or they might not add the plugin due to the included source.
Does the build script drop the source code if the dependency packages are available? That might make Debian/others happy but still have code for people using older systems?
One problem is it needs to try to switch to using json-glib and jsonrpc-glib as dependency packages not included source code.
The reason is that there's this performance problem
https://gitlab.gnome.org/GNOME/json-glib/-/merge_requests/60
which got only fixed in the latest 1.10 release which was released 1 month ago and probably isn't part of many distributions yet. I was hoping to use the bundled version until the latest dependencies get to more distros.
Since the performance problem only affects semantic tokens as far as I know (but now thinking about it, it could also be document symbols for the symbol tree), one possibility would be to ifdef-out semantic token support for older json-glib versions.
I will note some distros (I suspect Debian for eg) will require that or they might not add the plugin due to the included source.
Is there some policy preventing this? Couldn't I just claim these are the sources of the plugin? Scintilla and ctags are also bundled with Geany (and, well, it's true that Scintilla is supposed to be used this way and there's no official library version of ctags).
Does the build script drop the source code if the dependency packages are available?
There's nothing like that (yet). But would it be OK for Debian to fall back to the bundled version in this case?
got only fixed in the latest 1.10 release which was released 1 month ago and probably isn't part of many distributions yet
Yeah, it would be a while before distros support that version.
Is there some policy preventing this?
I don't know Debian policies, too complex, don't care.
My concern was from another project that I was reading, that was blocked because it included source for a library that was available on Debian. I am afraid I don't remember if the source had changes, if they were accepted upstream or not, and what the final solution was, I stopped following it since it all seemed too hard.
Neither Scintilla nor ctags libraries appear to be in the Debian repository (at least not in Linux Debian), so included source is fine.
But would it be OK for Debian to fall back to the bundled version in this case?
Debian expert advice somebody please?
But I would think it would be acceptable, you still need the source for Win and Mac, and so if the build only builds the source instead of depending on the library on Win, Mac, and Linux distros with library less that 1.10 or whatever version. This information should be clearly documented so that Debian and other packagers understand it is temporary until they have a suitable library version.
I presume `jsonrpc-glib` needs to use the matching version of `json-glib` and that is why its source is included too.
I presume jsonrpc-glib needs to use the matching version of json-glib and that is why its source is included too.
I don't think this is the case but if I used the system jsonrpc-glib, it would use the system (possibly old) json-glib and not the one statically linked to the plugin.
@techee pushed 1 commit.
ad5f3ebf0112a26dca3b85934ef2ee623e659fcc Sync to latest version from geany-lsp
@techee pushed 3 commits.
39749bbe618e2021bae16e8988fbeb6408a2161f Add LSP plugin 7b745c1ec6ab173b66dc2a5bba6a9c918c317f36 Backport fixes from the geany-lsp project cbb4bf8c8ee6e44bd57d4ecc0393306efaa79d4c Sync to latest version from geany-lsp
github-comments@lists.geany.org