Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

langserver parsing errors #306

Open
Q-Master opened this issue Mar 24, 2025 · 10 comments
Open

langserver parsing errors #306

Q-Master opened this issue Mar 24, 2025 · 10 comments

Comments

@Q-Master
Copy link

Both 1.8.1 and 1.10.0 doesn't pase correctly simple code using my packets library. nimble install packets.

import std/[parseopt]
import packets/packets
import packets/json/serialization


var uids: seq[string]


packet UserAuth:
  var userId* {.asName: "user_id".}: string
  var token*: string
  var ts: int64


proc main() =
  for kind, key, value in getopt():
    case kind
    of cmdEnd: break
    of cmdShortOption, cmdLongOption:
      discard
    of cmdArgument:
      uids.add(key)


when isMainModule:
  main()

1.8.1 just says that
Redefining UserAuth: line 10, column 3
1.10.0 rotating forever "checking file test_code.nim" in VS code toolbar.

This code is perfectly built and working while compiled nim c test_code.nim.

Both 1.8.1 and 1.10.0 depending on nim 2.0.8, but current stable is 2.2.2 and there are some warnings about this while nimble install nimlangserver.
Also while building 1.10.0 there are a big bunch of warnings in chronos libs.

1.8.1 starts, nimble somehow is dead. (no idea why does nimble start even. the flag about starting nimble in directory is disabled in settings)

 105829 ?        S      0:00 /bin/sh -c /home/qmaster/.nimble/pkgs2/nimlangserver-1.8.1-ac7e989771b76024869c1899b21b6bed92d047e1/nimlangserver --stdio
 105830 ?        Sl     0:00 /home/qmaster/.nimble/pkgs2/nimlangserver-1.8.1-ac7e989771b76024869c1899b21b6bed92d047e1/nimlangserver --stdio
 106370 ?        S      0:00 /home/qmaster/.nimble/bin/nimsuggest /home/qmaster/tools/test_code.nim --v4 --autobind --clientProcessId:105830 --exceptionInlayHints:on
 106371 ?        Sl     0:04 /home/qmaster/.choosenim/toolchains/nim-2.2.2/bin/nimsuggest /home/qmaster/tools/test_code.nim --v4 --autobind --clientProcessId:105830 --exceptionInlayHints:on
 107482 ?        Z      0:00 [nimble] <defunct>

1.10.0 starts the same and nimble is also dead.
--exceptionInlayHints: is somehow sometimes on and sometimes off for same file without changing anything.

@Richie-Jang
Copy link

Same to me.. on Win11 System / nim --version : 2.2.2

After changing 1.10.0, forever "checking file ___.nim" in vs code status bar... And three more instances are running...
and lacking { code completion / hover information } when I open the other nim file..
But on 1.8.1 was working fine..

Thank you for updating nimlangserver.. Please make it more stable..
Thank you again.

@jmgomez
Copy link
Collaborator

jmgomez commented Mar 25, 2025

@Q-Master had you ran nimble setup so you have a nimble.paths file?

@Q-Master
Copy link
Author

Q-Master commented Mar 25, 2025

@jmgomez

@Q-Master had you ran nimble setup so you have a nimble.paths file?

I have no nimble file in that path, because of no need. Auto running nimble setup is disabled in the config of VS code extension, but nimble is somehow called anyways and dies.

$ nimble setup
       Tip: 2 messages have been suppressed, use --verbose to show them.
packageinfo.nim(280)     findNimbleFile

    Error:  Could not find a file with a .nimble extension inside the specified directory: /home/qmaster/tools

Do nimble file is a must now?

@jmgomez
Copy link
Collaborator

jmgomez commented Mar 25, 2025

Well, you need to pass the search paths of your libraries to nimsuggest. nimble setup is one way to do that, another is to have a config.nims file

@Q-Master
Copy link
Author

Well, you need to pass the search paths of your libraries to nimsuggest. nimble setup is one way to do that, another is to have a config.nims file

@jmgomez It was working perfectly before, and definitely working (almost fine) in v1.8.1. Why do I need to pass search paths to langserver if they're default ones like ~/.nimble/pkgs2? The nim file path is also definitely passed to langserver as full path. What other paths do I need to supplement to langserver?

Anyways, why do langserver says that
Redefining UserAuth: line 10, column 3
in my example. Nim compiles that without any problems, saem's plugin also worked ok with that code.
Both without any nimble files and any setups.

@jmgomez
Copy link
Collaborator

jmgomez commented Mar 26, 2025

Yes, you are right for a moment I thought you had a different issue where the paths wasnt being picked up.

The nimsuggest instance it picks is the one you have in your path. It just forwards the error nimsuggest chk provides. So likely the issue of Redefining UserAuth: line 10, column 3 is a nimsuggest one.

The checking project spinner is fixed in the sources. A patch is coming soon

@Q-Master
Copy link
Author

There's also an issue with dead nimble instance. 1.8.1 seems suffer less from this problem.

@jmgomez
Copy link
Collaborator

jmgomez commented Mar 26, 2025

Dont see how as latest nimble related change was introduced in 1.8.0. That said, in the next patch there is also a potential fix for it. If it doesnt fix it (as I cant repro it) it may be an issue with chronos that requires further research. You can test it out by yourself by using the latest binary or building from sources, if you do, it will be great if you can report the results back

@Q-Master
Copy link
Author

@jmgomez thnx alot.
Can you plz point me to issues of the nimsuggest to copypaste there the issue with Redefining UserAuth: line 10, column 3?

@jmgomez
Copy link
Collaborator

jmgomez commented Mar 27, 2025

Sure, its the same repo as nim itself: https://github.com/nim-lang/Nim/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants