EliotVU / UnrealScript-Language-Service

Bringing a work-in-progress intelliSense to ye olde UnrealScript :)
MIT License
48 stars 9 forks source link

[Bug]: Server crashing during glob #171

Closed davidoskky closed 1 year ago

davidoskky commented 1 year ago

Describe the bug

At startup the server crashes. The text is still marked up, but going to function definition and so on is impossible. I'm running vscode on linux.

[Info  - 7:31:12 PM] Connection to server got closed. Server will restart.
[Info  - 7:31:12 PM] Re-indexing workspace due configuration changes.
[Info  - 7:31:12 PM] Scanning folder '/home/user/Mod' using pattern '/**/*.{u,upk}', '/**/*.{uc,uci}'
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, lstat '/home/user/Mod/home'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/home/user/Mod/home'
}

If I add a directory named home in the folder I get the following error:

[Info  - 7:32:15 PM] Connection to server got closed. Server will restart.
[Info  - 7:32:15 PM] Re-indexing workspace due configuration changes.
[Info  - 7:32:15 PM] Scanning folder '/home/user/Mod' using pattern '/**/*.{u,upk}', '/**/*.{uc,uci}'
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, lstat '/home/user/Mod/home/user'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/home/user/Mod/home/user'
}

It's trying to traverse the project path twice. I'm unable to build the project by following your instructions, however I feel that it may be related to the globbing https://github.com/EliotVU/UnrealScript-Language-Service/blob/394fe7de4b93eba9310edfb543c263104960f80d/server/src/server.ts#L124

Screenshots

No response

davidoskky commented 1 year ago

@EliotVU I may look into fixing this, but I'm unable to correctly compile the project, or at least to have it running for testing. Are all the instructions in the build section correct and complete or shall I do something else? Bear with me, I barely ever worked with javascript, let alone typescript.

EliotVU commented 1 year ago

@davidoskky The instructions should be working, at least on a Windows setup. I just updated the instructions to be more straight forward. Also the installation will require the Java SDK in order to compile the ANTLR grammar files.

Could you elaborate what exactly isn't working during the setup process?

davidoskky commented 1 year ago

When I run the debug mode a new window of vscode opens but a bunch of errors show up.

When I run manually npm run compile:grammar i get error(114): grammars/UCParser.g4:4:17: cannot find tokens file 'grammars/UCLexer.tokens' followed by a bunch of errors regarding the implicit definition of tokens, I feel this is where the problem is coming from.

I can find that file under server/src/UC/antlr/generated/grammar/ but not under grammars/

EliotVU commented 1 year ago

Does running npm run compile:grammar work? Perhaps the commandlines are invalid on a linux system.

davidoskky commented 1 year ago

No, it fails:

> uc@0.6.4 compile:grammar
> npx antlr4ts -visitor -no-listener grammars/UCLexer.g4 -o server/src/UC/antlr/generated && npx antlr4ts -visitor -no-listener grammars/UCParser.g4 -o server/src/UC/antlr/generated

Generating file '/home/user/Contributions/UnrealScript-Language-Service/server/src/UC/antlr/generated/grammars/UCLexer.interp' for grammar 'grammars/UCLexer.g4'
Generating file '/home/user/Contributions/UnrealScript-Language-Service/server/src/UC/antlr/generated/grammars/UCLexer.ts' for grammar 'grammars/UCLexer.g4'
Generating file '/home/user/Contributions/UnrealScript-Language-Service/server/src/UC/antlr/generated/grammars/UCLexer.tokens' for grammar 'grammars/UCLexer.g4'
error(114): grammars/UCParser.g4:4:17: cannot find tokens file 'grammars/UCLexer.tokens'
warning(125): grammars/UCParser.g4:38:6: implicit definition of token 'ID' in parser
warning(125): grammars/UCParser.g4:218:38: implicit definition of token 'DOT' in parser
warning(125): grammars/UCParser.g4:221:3: implicit definition of token 'SHARP' in parser
...
child process exited with code  1
EliotVU commented 1 year ago

I found this issue at https://github.com/tunnelvisionlabs/antlr4ts/issues/303 Apparently appending -Xexact-output-dir to the cmd is a viable workaround.