Code Monkey home page Code Monkey logo

Comments (5)

matthewnourse avatar matthewnourse commented on August 15, 2024 1

No problem, I added some logging at the top of the onStdout function...

function onStdout(filetype)
        return function (text)
                micro.Log("In onStdout.function, text=<<<" .. text .. ">>>")

My test.js file is:

unction f() {

}

(Deliberately broken so I can quickly see if the language server reports an error)

My settings.json is:

{
    "lsp.ignoreTriggerCharacters": "completion,signature",
    "lsp.server": "cn=clangd,python=pyls,typescript=typescript-language-server --stdio,javascript=typescript-language-server --stdio",
    "lsp.tabcompletion": true,
    "tabstospaces": true
}

When I run micro -debug test.js, log.txt is:

2024/04/30 22:49:55 Micro started
2024/04/30 22:49:55 ONBUFFEROPEN unknown
2024/04/30 22:49:55 ONBUFFEROPEN unknown
2024/04/30 22:49:55 ONBUFFEROPEN javascript
2024/04/30 22:49:55 Server Options map[1:cn=clangd 2:python=pyls 3:typescript=typescript-language-server --stdio 4:javascript=typescript-language-server --stdio 5:python=pylsp 6:go=gopls 7:typescript=deno lsp 8:javascript=deno lsp 9:markdown=deno lsp 10:json=deno lsp 11:jsonc=deno lsp 12:rust=rust-analyzer 13:lua=lua-lsp 14:c++=clangd]
2024/04/30 22:49:55 Starting server javascript
2024/04/30 22:49:55 javascript>>> initialize
2024/04/30 22:49:55 exec: "micro-clip": executable file not found in $PATH;Wayland display not found;exec: "xclip": executable file not found in $PATH;exec: "xsel": executable file not found in $PATH;exec: "powershell.exe": executable file not found in $PATH;exec: "termux-clipboard-get": executable file not found in $PATH;  or change 'clipboard' option
2024/04/30 22:49:56 In onStdout.function, text=<<<Content-Length: 212

>>>
2024/04/30 22:49:56 In onStdout.function, text=<<<{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Using Typescript version (bundled) 5.4.5 from path \"/usr/local/#######################/lib/node_modules/typescript/lib/tsserver.js\""}}Content-Length: 1554

{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"completionProvider":{"triggerCharacters":[".","\"","'","/","@","<"],"resolveProvider":true},"codeActionProvider":true,"codeLensProvider":{"resolveProvider":true},"definitionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["_typescript.applyWorkspaceEdit","_typescript.applyCodeAction","_typescript.applyRefactoring","_typescript.configurePlugin","_typescript.organizeImports","_typescript.applyRenameFile","_typescript.goToSourceDefinition"]},"hoverProvider":true,"inlayHintProvider":true,"linkedEditingRangeProvider":false,"renameProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",","<"],"retriggerCharacters":[")"]},"workspaceSymbolProvider":true,"implementationProvider":true,"typeDefinitionProvider":true,"foldingRangeProvider":true,"semanticTokensProvider":{"documentSelector":null,"legend":{"tokenTypes":["class","enum","interface","namespace","typeParameter","type","parameter","variable","enumMember","property","function","member"],"tokenModifiers":["declaration","static","async","readonly","defaultLibrary","local"]},"full":true,"range":true},"workspace":{"fileOperations":{"willRename":{"filters":[{"scheme":"file","pattern":{"glob":"**/*.{ts,js,jsx,tsx,mjs,mts,cjs,cts}","matches":"file"}},{"scheme":"file","pattern":{"glob":"**","matches":"folder"}}]}}}}}}>>>
2024/04/30 22:49:56 javascript <<< window/logMessage
2024/04/30 22:49:56 Using Typescript version (bundled) 5.4.5 from path "/usr/local/#######################/lib/node_modules/typescript/lib/tsserver.js"

As you can see, the text value that starts with {"jsonrpc":"2.0","method":"window/logMessage" contains a message body plus the content-length and body of the next message.

$ micro -version
Version: 2.0.13
Commit hash: 68d88b57
Compiled on October 21, 2023

I'm running the micro-plugin-lsp that I git-cloned earlier today.

The OS is Debian Bookworm.

I hope this helps, please let me know if you'd like me to try anything else.

from micro-plugin-lsp.

AndCake avatar AndCake commented on August 15, 2024

Can you provide more detail on this? What's the first message and what is the second one? I tried to reproduce it but so far haven't come across this problem.

from micro-plugin-lsp.

AndCake avatar AndCake commented on August 15, 2024

Thank you! This helps a lot! I see where the issue comes from: essentially the onStdout function is assuming that the command is either incomplete or ends with a }. Here neither is really true.

I think I can work with this.

Thanks again!

from micro-plugin-lsp.

AndCake avatar AndCake commented on August 15, 2024

I pushed a quick change for this on master, can you check if it works for you?

from micro-plugin-lsp.

matthewnourse avatar matthewnourse commented on August 15, 2024

My pleasure!
Thanks for the super-fast fix, it works for me!

from micro-plugin-lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.