Giter VIP home page Giter VIP logo

Comments (7)

jeremyVignelles avatar jeremyVignelles commented on August 11, 2024

I added the path to the lib folder, that contains the file to the jpath config:

/home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib

now, ctrl+clicking the file name can correctly navigate to the libjsonnet file, but there is no completion for ddb.<ctrl+space>

The log:

time="2023-08-16T14:13:37+02:00" level=info msg="Starting the language server"
time="2023-08-16T14:13:37+02:00" level=info msg="Initializing jsonnet-language-server version 0.12.1"
time="2023-08-16T14:13:37+02:00" level=info msg="Reading stdlib"
time="2023-08-16T14:13:38+02:00" level=debug msg="Publishing diagnostics for file:///home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet"
time="2023-08-16T14:13:38+02:00" level=debug msg="Publishing diagnostics for file:///home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet"
time="2023-08-16T14:13:38+02:00" level=debug msg="Done publishing diagnostics for file:///home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet"
time="2023-08-16T14:13:38+02:00" level=debug msg="Done publishing diagnostics for file:///home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet"
time="2023-08-16T14:13:48+02:00" level=debug msg="Unable to resolve jpath for /home/vagrant/projects/THE-PROJECT/docker-compose.yml.jsonnet: unable to identify the project root.\nTried to find 'tkrc.yaml' or 'jsonnetfile.json' in the parent directories.\nPlease refer to https://tanka.dev/directory-structure for more information"
time="2023-08-16T14:13:48+02:00" level=debug msg="Unable to resolve jpath for /home/vagrant/projects/THE-PROJECT/docker-compose.yml.jsonnet: unable to identify the project root.\nTried to find 'tkrc.yaml' or 'jsonnetfile.json' in the parent directories.\nPlease refer to https://tanka.dev/directory-structure for more information"
time="2023-08-16T14:13:48+02:00" level=error msg="Completion: error finding ranges: field  was not found in ast.DesugaredObject"
time="2023-08-16T14:13:49+02:00" level=debug msg="Publishing diagnostics for file:///home/vagrant/projects/THE-PROJECT/docker-compose.yml.jsonnet"
time="2023-08-16T14:13:49+02:00" level=debug msg="Done publishing diagnostics for file:///home/vagrant/projects/THE-PROJECT/docker-compose.yml.jsonnet"

that message is making me wondering what's wrong:

time="2023-08-16T14:13:48+02:00" level=error msg="Completion: error finding ranges: field  was not found in ast.DesugaredObject"

while importing the file that way works:

local ddb = import '/home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet';

The libjsonnet file : https://github.com/inetum-orleans/docker-devbox-ddb/blob/develop/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet

from vscode-jsonnet.

julienduchesne avatar julienduchesne commented on August 11, 2024

Can you try to disable the "Tanka Mode" setting?

from vscode-jsonnet.

jeremyVignelles avatar jeremyVignelles commented on August 11, 2024

Same: (EDIT: it's even worse, the ctrl+click doesn't work anymore)

time="2023-08-16T14:56:31+02:00" level=info msg="Starting the language server"
time="2023-08-16T14:56:31+02:00" level=info msg="Initializing jsonnet-language-server version 0.12.1"
time="2023-08-16T14:56:31+02:00" level=info msg="Reading stdlib"
time="2023-08-16T14:56:32+02:00" level=debug msg="Publishing diagnostics for file:///home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet"
time="2023-08-16T14:56:32+02:00" level=debug msg="Publishing diagnostics for file:///home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet"
time="2023-08-16T14:56:32+02:00" level=debug msg="Done publishing diagnostics for file:///home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet"
time="2023-08-16T14:56:32+02:00" level=debug msg="Done publishing diagnostics for file:///home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib/ddb.docker.libjsonnet"
time="2023-08-16T14:56:34+02:00" level=error msg="Completion: error finding ranges: field  was not found in ast.DesugaredObject"
time="2023-08-16T14:56:34+02:00" level=debug msg="Publishing diagnostics for file:///home/vagrant/projects/THE-PROJECT/docker-compose.yml.jsonnet"
time="2023-08-16T14:56:34+02:00" level=debug msg="Done publishing diagnostics for file:///home/vagrant/projects/THE-PROJECT/docker-compose.yml.jsonnet"
time="2023-08-16T14:56:36+02:00" level=error msg="Completion: error finding ranges: field  was not found in ast.DesugaredObject"

Is there any way I can know what jpath is passed to the language server ?

NOTE: I'm using the extension in a remote SSH session, could it cause any issue ?

from vscode-jsonnet.

jeremyVignelles avatar jeremyVignelles commented on August 11, 2024

It seems that the jpath variable here is never used. Am I right to assume that I should trigger a configuration change rather than restarting the server in order to apply the jpath config properly ? Which path syntax should I use on windows/on linux ?

from vscode-jsonnet.

julienduchesne avatar julienduchesne commented on August 11, 2024

It seems that the jpath variable here is never used. Am I right to assume that I should trigger a configuration change rather than restarting the server in order to apply the jpath config properly ? Which path syntax should I use on windows/on linux ?

It's supposed to be passed in the DidChangeConfiguration hook:

jpath: jpath,
which is sent on startup as well

from vscode-jsonnet.

jeremyVignelles avatar jeremyVignelles commented on August 11, 2024

It is called on startup, but not on "jsonnet.restartLanguageServer"

Inside the startClient method, it does not seem to have any effect.

By restarting the vscode window, I got it to work, but even after a configuration change trigger, it seems a bit flaky with the error message in my second post.

from vscode-jsonnet.

jeremyVignelles avatar jeremyVignelles commented on August 11, 2024

So, to sum up: When I was testing, I was just hitting "Jsonnet: Restart Language Server" instead of restarting VSCode. It seems to work better now, with a working configuration.

The configuration I have:

{
  "jsonnet.languageServer.jpath": [
    "/home/vagrant/.docker-devbox/ddb/ddb/feature/jsonnet/lib"
  ],
  "jsonnet.languageServer.tankaMode": false
}

After starting the window again, the import is properly resolved and completion works as expected.

I submitted #31 to fix the issue of the configuration being lost on server restart.

On windows, it doesn't work, but I don't know yet if that's my fault or not. I'll keep you posted.

from vscode-jsonnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.