7HR4IZ3 / acode-language-client

Acode language client plugin
8 stars 2 forks source link

Autoclose when is used to program with clangd #1

Open DuilioPerez opened 8 months ago

DuilioPerez commented 8 months ago

Hello! I'm a C/C++ programmer. I've used Vim in Termux to program in C/C++ and I have a plugin installed to use autocompletion and error detection. Many time after, I used Acode to write my code. Since a few time ago, I've see your plugin in Acode Plugins. So I installed. I've see it works fine, but after a few seconds autocompletion stops and few seconds after that, error checking fails too. I'm not used to web programming languages, so I don't know how to fix this.

7HR4IZ3 commented 8 months ago

Hello, Thanks for submitting this issue..

It's likely the server crashed, although I made it so even if the server crashes, if you restart the server you should be able to continue where you left off. I'll hopefully provide a fix by tomorrow..

If you don't mind please share a screenshot of termux outputs after Acode Language Server stops working..

Also i made a Vim keybindings plugin for Acode, if you are interested..

DuilioPerez commented 8 months ago

Hello again! I've made a screen recorder of what happens

https://github.com/7HR4IZ3/acode-language-client/assets/135564120/80684510-43d3-4a74-800e-e1c35d223409

As you can see, I have installed the two plugins, the language client and the C/C++ client. And I have clangd. And yes, I'll give a try to your plugin about vim keybindings. Thanks for reading, and I hope you'll fix this bug

7HR4IZ3 commented 8 months ago

Hello, I think I know what the problem is..

So essentially, Acode Language Client uses nodejs sockets to communicate with the server running in termux, which in turn forwards all messages, from the language server process to the socket and from the socket to the language server process.

Problem is when working with the process stdout, sometimes a language server might send the response for a request immediately after the response of another request so what is sent to the socket looks something like this '{...}{...}' the first being a previous response followed immediately after with another response, hence when it gets to Acode Language Client, which is expecting a json object, it crashes and throws a json parse error.

I'll recommend you install Acode SDK Plugin which adds a console to Acode so you'll know when such errors occur..

This happens randomly, hence it working sometimes and not working other times.

I'm still trying to fix this though, I'll update the server and notify you when ready..

By the way, for cases when you have started the server, opened acode, and opened a file, but nothing still works, closing and reopening that file should work.

DuilioPerez commented 8 months ago

I've used Acode SDK plugin and I've found the next warning:

Error {name: "MaxListenersExceededWarning", emitter: r, type: "2-/sdcard/Programming/Cpp/test.c", count: 51} count: 51 emitter: Object name: "MaxListenersExceededWarning" type: "2-/sdcard/Programming/Cpp/test.c" message: "Possible EventEmitter memory leak detected. 51 2-/sdcard/Programming/Cpp/test.c listeners added. Use emitter.setMaxListeners() to increase limit" stack: "MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 51 2-/sdcard/Programming/Cpp/test.c listeners added. Use emitter.setMaxListeners() to increase limit↵ at h (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/277.js:2:1867)↵ at c.addListener (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/277.js:2:4429)↵ at r.postMessage (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:24287)↵ at r.doComplete (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:23244)↵ at g.doComplete (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:18018)↵ at https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:18320↵ at p.$sendDeltaQueue (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:20453)↵ at Object.getCompletions (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:18293)↵ at https://localhost/js/ace/ext-language_tools.js:1:48108↵ at Array.forEach ()" get stack: ƒ () set stack: ƒ ()

And the next error: Connection is disposed. at he (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/main.js:2:268132) at Object.sendRequest (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/main.js:2:270197) at d.findDocumentHighlights (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/main.js:2:342736) at https://localhost/__cdvfile_files-external__/plugins/acode.language.client/798.js:1:3048 at Array.map () at EventTarget. (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/798.js:1:3032) at Object.postMessage (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/main.js:2:427365) at r.postMessage (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:24308) at r.findDocumentHighlights (https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:24057) at https://localhost/__cdvfile_files-external__/plugins/acode.language.client/355.js:1:15148

DuilioPerez commented 8 months ago

As I've said, I'm not used to web languages, so I don't know what does it means.

DuilioPerez commented 8 months ago

Termux shows this: node:events:496 throw er; // Unhandled 'error' event ^

Error: write EPIPE at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:169:8) at emitErrorCloseNT (node:internal/streams/destroy:128:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -32, code: 'EPIPE', syscall: 'write' }

Node.js v20.11.1

7HR4IZ3 commented 7 months ago

Hello, Sorry it took a long time, this issue has been fixed just update the plugin and the server.

DuilioPerez commented 7 months ago

Hello. Now it seem there are issues with the server. I've updated and now it doesn't show any completion, not even the first line. It shows the next log: Server listening on port 3030 Connecting to auto client: clangd [] I[06:43:02.033] clangd version 17.0.6 I[06:43:02.036] Features: linux I[06:43:02.036] PID: 29857 I[06:43:02.036] Working directory: /data/data/com.termux/files/home I[06:43:02.036] argv[0]: clangd I[06:43:02.039] Starting LSP over stdin/stdout I[06:43:02.043] <-- initialize(0) I[06:43:02.054] --> reply:initialize(0) 11 ms I[06:43:02.056] <-- textDocument/didClose E[06:43:02.056] Failed to decode textDocument/didClose request: failed to parse URI at (root).textDocument.uri I[06:43:02.056] <-- textDocument/didOpen E[06:43:02.056] Failed to decode textDocument/didOpen request: failed to parse URI at (root).textDocument.uri I[06:43:02.070] <-- initialized I[06:43:02.071] <-- workspace/didChangeConfiguration I[06:43:02.072] <-- workspace/didChangeConfiguration I[06:43:02.073] <-- textDocument/didOpen E[06:43:02.073] Failed to decode textDocument/didOpen request: failed to parse URI at (root).textDocument.uri I[06:43:16.379] <-- textDocument/documentHighlight(1) E[06:43:16.379] Failed to decode textDocument/documentHighlight request: failed to parse URI at (root).textDocument.uri I[06:43:16.379] --> reply:textDocument/documentHighlight(1) 0 ms, error: -32602: failed to decode textDocument/documentHighlight request: failed to parse URI at (root).textDocument.uri I[06:43:16.468] <-- textDocument/didChange E[06:43:16.469] Failed to decode textDocument/didChange request: failed to parse URI at (root).textDocument.uri I[06:43:16.471] <-- textDocument/completion(2) E[06:43:16.471] Failed to decode textDocument/completion request: failed to parse URI at (root).textDocument.uri I[06:43:16.471] --> reply:textDocument/completion(2) 0 ms, error: -32602: failed to decode textDocument/completion request: failed to parse URI at (root).textDocument.uri I[06:43:16.515] <-- textDocument/documentHighlight(3) E[06:43:16.515] Failed to decode textDocument/documentHighlight request: failed to parse URI at (root).textDocument.uri I[06:43:16.515] --> reply:textDocument/documentHighlight(3) 0 ms, error: -32602: failed to decode textDocument/documentHighlight request: failed to parse URI at (root).textDocument.uri I[06:43:16.692] <-- textDocument/didChange E[06:43:16.693] Failed to decode textDocument/didChange request: failed to parse URI at (root).textDocument.uri I[06:43:16.695] <-- textDocument/completion(4) E[06:43:16.695] Failed to decode textDocument/completion request: failed to parse URI at (root).textDocument.uri I[06:43:16.696] --> reply:textDocument/completion(4) 0 ms, error: -32602: failed to decode textDocument/completion request: failed to parse URI at (root).textDocument.uri I[06:43:16.740] <-- textDocument/documentHighlight(5) E[06:43:16.741] Failed to decode textDocument/documentHighlight request: failed to parse URI at (root).textDocument.uri I[06:43:16.741] --> reply:textDocument/documentHighlight(5) 0 ms, error: -32602: failed to decode textDocument/documentHighlight request: failed to parse URI at (root).textDocument.uri I[06:43:17.198] <-- textDocument/signatureHelp(6) E[06:43:17.198] Failed to decode textDocument/signatureHelp request: failed to parse URI at (root).textDocument.uri I[06:43:17.199] --> reply:textDocument/signatureHelp(6) 0 ms, error: -32602: failed to decode textDocument/signatureHelp request: failed to parse URI at (root).textDocument.uri E[06:43:17.289] JSON parse error: [1:220, byte=220]: Expected , or } after object property I[06:43:17.291] Warning: Missing Content-Length header, or zero-length message. I[06:43:17.337] Warning: Missing Content-Length header, or zero-length message. I[06:43:17.463] Warning: Missing Content-Length header, or zero-length message.

7HR4IZ3 commented 7 months ago

Did you also update the plugin??

DuilioPerez commented 7 months ago

Yes, it's up to date