Closed Alexey-T closed 1 year ago
also if I press ctrl+space on empty line and choose something - no text will be added.
Yes, confirmed it
but cmd names are inserted with
()
:
Sublime has support for "completion snippets", therefore it doesn't insert ()
manually.
It relies on lsp-server snippet text.
For CudaText snippetSupport
is set to False
, so Cuda_LSP is manually inserting ()
based on "completion item kind" (i.e. if function/method then insert ()
)
I enabled support for snippets format (simply set snippetSupport
to True
in CAPABILITIES)
https://github.com/CudaText-addons/cuda_lsp/pull/21
now we can get func()
text from server, (no need to manually insert parentheses)
but snippets could be not just plain text, it could be a lot more then simple text.
I don't know anything about it yet, but I created this draft PR so we can test it and see how it behaves with different lsp-servers.
maybe you, @Alexey-T , know something about this snippet format:
I see that for bash it now doesn't insert ()
, (like in Sublime)
for clangd it inserts ()
(like in Sublime)
for python it doesn't insert ()
(like in Sublime)
Yes I know about this snip-format. we use it (almost it) in Snippets plug. And you cannot just insert snippets text for any complex snippet, if it has tabstops.
https://wiki.freepascal.org/CudaText_plugins#Format_of_snippet_files
If you got from server snippet-text with tabstops (find ${
) then we are in bad situation
We need lsp-server that will provide us with complex snippets, so we can test it.
Can we ask (the detailed question) at https://github.com/sublimelsp/LSP/issues ?
code from sublimelsp:
if item.get("insertTextFormat", InsertTextFormat.PlainText) == InsertTextFormat.Snippet:
self.view.run_command("insert_snippet", {"contents": new_text})
else:
self.view.run_command("insert", {"characters": new_text})
as you can see Sublime Text have internal command "insert_snippet" which is inside closed sources.
We have 'insert-snippet' code in open source! can you grab it from Snippets plugin?
OK
This is interesting!
@eltonfabricio10 do you have another completion addon enabled? or only Cuda_lsp? maybe snippets addon?
Cuda_lsp and complete_from_text(lexers=-,ini files,markdown,restructuredtext,properties,bash script)
I removed lexer bash from complete_from_text... Now it's working as I want... Sorry for my wrong configuration.
@veksha No, that was a plugin bug, see #120 .
If you see 'warnings' instead of 'errors' - it is Shellcheck issue! please report to them. maybe Windows version differs from Linux?
Sample bash file giving 'errors' for me
#/bin/sh
cp -rf $from/data $app/Contents/Resources
cp -rf $from/settings_default $app/Contents/Resources
mkdir $app/Contents/Resources/py/cuda_comments
[[sdfsdf 343 --:::
] [[[sdfsdf #$#$ #$#$mkdir $app/Contents/Resources/py/cuda_new_file
)) (sdfsdf #$#$ #$#$mkdir $app/Contents/Resources/py/cuda_new_file
zdf
If you see 'warnings' instead of 'errors' - it is Shellcheck issue! please report to them. maybe Windows version differs from Linux?
I see errors now! just not for "zdf" kind of lines. I don't see a lot of keywords like "rm", "rmdir", (etc) in the list. it's issue of server.
but cmd names are inserted with
()
: egrmdir()
.
with snippetSupport branch merged parentheses will be inserted by lsp-server, not by lsp-client. so this issue can now be closed.
On ubuntu i see ok completions.
but cmd names are inserted with
()
: egrmdir()
. @veksha