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

Help setting on Sublime #22

Closed
lf-araujo opened this issue May 26, 2019 · 3 comments
Closed

Help setting on Sublime #22

lf-araujo opened this issue May 26, 2019 · 3 comments

Comments

@lf-araujo
Copy link

Thank you for this software @PMunch.

I have been facing a little difficulty on making it work on sublime text. I installed it using nimble, all binaries are in the PATH, but the sublime console prints:

server: Unable to find "config/nim.cfg" in "/tmp/nimble_22113/githubcom_PMunchnimlsp/src/nimlsppkg/Nim". Supply the Nim project folder by adding it as an argument.
Failure writing to stdout
Traceback (most recent call last):
  File "/home/luis/.config/sublime-text-3/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 201, in write_stdin
    self.process.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

My LSP settings:

// Settings in here override those in "LSP/LSP.sublime-settings",

{
   "clients":
   {
      "nim":
      {
         "command":
         [
            "nimlsp" // This can be changed if you put nimlsp in your PATH
         ],
         "enabled": true,
         "env":
         {
            "PATH": "/home/luis/.nimble/bin/"// To be able to find nimsuggest, can be changed if you have nimsuggest in your PATH
         },
         "languageId": "nim",
         "scopes":
         [
            "source.nim"
         ],
         "syntaxes":
         [
            "Packages/NimLime/Syntaxes/Nim.tmLanguage"
         ]
      }
   },
   // These are mostly for debugging feel free to remove them
   // If you build nimlsp without debug information it doesn't
   // write anything to stderr
   "log_payloads": true,
   "log_stderr": true
}

So it seems it seeks for a nim.cfg file on a /tmp directory, which is not there.

  • What might be happening? Any ideas?

Many thanks.

@PMunch
Copy link
Owner

PMunch commented May 27, 2019

Ah yes, nimlsp needs some of Nim's files in order to work properly. During the building of this package these sources are pulled into the package as a git submodule, which nimlsp then defaults to as the location of these files. But when doing nimble install nimlsp this is created in a temporary location, and therefore will not exist once the package is actually installed. As the error messages mentions you can override the default path to the Nim files by supplying it as an argument to the program. In Sublime this is probably done with something like this:

"command":
[
    "nimlsp /path/to/Nim/files"
]

If you use choosenim to install Nim you can use choosenim show to get the path to this directory. If someone would create a PR to try and find Nim when it's not explicitly given then I would be happy to accept it.

@PMunch PMunch closed this as completed May 27, 2019
@moigagoo
Copy link
Contributor

@PMunch Hi! I'm trying to set up nimlsp with Sublime Text 3. Followed your instructions and read the issue. It seems like nothing is happening, although I don't see any errors.

My LSP.settings file: https://pastebin.com/bJuSxBM4

Where should I look for errors?

@lf-araujo
Copy link
Author

It should read something like:

{
   "clients":
   {
      "nim":
      {
         "command":
         [
            "/home/luis/.nimble/bin/nimlsp","/home/luis/.choosenim/toolchains/nim-0.20.0" // This can be changed if you put nimlsp in your PATH
         ],
         "enabled": true,
         "env":
         {
            "PATH": "/home/luis/.nimble/bin/" // To be able to find nimsuggest, can be changed if you have nimsuggest in your PATH
         },
         "languageId": "nim",
         "scopes":
         [
            "source.nim"
         ],
         "syntaxes":
         [
            "Packages/NimLime/Syntaxes/Nim.tmLanguage"
         ]
      }
   },
   // These are mostly for debugging feel free to remove them
   // If you build nimlsp without debug information it doesn't
   // write anything to stderr
   "log_payloads": true,
   "log_stderr": true
}

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