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

Error: Call listen() first #15

Open
wbudic opened this issue Sep 30, 2019 · 2 comments
Open

Error: Call listen() first #15

wbudic opened this issue Sep 30, 2019 · 2 comments

Comments

@wbudic
Copy link

wbudic commented Sep 30, 2019

Getting server crashing, output:

Error: Call listen() first.
at throwIfNotListening (/home/will/.vscode/extensions/sfodje.perlcritic-1.0.2/server/node_modules/vscode-jsonrpc/lib/main.js:626:19)
at Object.sendRequest (/home/will/.vscode/extensions/sfodje.perlcritic-1.0.2/server/node_modules/vscode-jsonrpc/lib/main.js:716:13)
at Object.sendRequest (/home/will/.vscode/extensions/sfodje.perlcritic-1.0.2/server/node_modules/vscode-languageserver/lib/main.js:737:54)
at RemoteWindowImpl.showErrorMessage (/home/will/.vscode/extensions/sfodje.perlcritic-1.0.2/server/node_modules/vscode-languageserver/lib/main.js:407:33)
at validateExecutable (/home/will/.vscode/extensions/sfodje.perlcritic-1.0.2/server/out/server.js:89:27)
at Object. (/home/will/.vscode/extensions/sfodje.perlcritic-1.0.2/server/out/server.js:66:17)
at Object. (/home/will/.vscode/extensions/sfodje.perlcritic-1.0.2/server/out/server.js:266:3)
at Module._compile (internal/modules/cjs/loader.js:693:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10)
at Module.load (internal/modules/cjs/loader.js:602:32)
[Info - 2:23:54 am] Connection to server got closed. Server will restart.
/home/will/.vscode/extensions/sfodje.perlcritic-1.0.2/server/node_modules/vscode-jsonrpc/lib/main.js:626
throw new Error('Call listen() first.');

@DanFreed
Copy link

For anyone that hits this issue, to work around it modify your path so that "which perlcritic" can resolve perlcriitic. The error is occurring because when it is not in your path, the server extension is validating it can find it as part of its default settings. If it cannot it issues:

connection.window.showErrorMessage(error);

This will trigger the error you are seeing.

@DanFreed
Copy link

Fix:

diff --git a/server/src/server.ts b/server/src/server.ts
index f4f29bf..ea3d575 100644
--- a/server/src/server.ts
+++ b/server/src/server.ts
@@ -104,6 +104,7 @@ connection.onDidChangeConfiguration(change => {
try {
globalSettings = mergeSettings(change.settings.perlcritic);
} catch (error) {

  •           connection.console.log(error);^M
              // do nada
      }
    

@@ -116,7 +117,7 @@ function validateExecutable(executable: string): string {
return which.sync(executable);
}
catch (error) {

  •           connection.window.showErrorMessage(error);
    
  •           connection.console.log(error);
              return "";
      }
    

}

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

2 participants