grafana / vscode-jsonnet

Full code support (formatting, highlighting, navigation, etc) for Jsonnet
Apache License 2.0
66 stars 7 forks source link

Can't navigate to an import file on windows #32

Open jeremyVignelles opened 10 months ago

jeremyVignelles commented 10 months ago

Following my success in getting #30 to work on a remote linux, I'm trying to achieve the same by copying the libjsonnet I got from the server and working locally, on a windows 10 PC.

I got some kind of success by Using this configuration:

{
  "jsonnet.languageServer.jpath": [
    "C:/workspace/tools/libjsonnet"
  ],
  "jsonnet.languageServer.tankaMode": false
}

The autocompletion works, but unlike the linux version, I get a warning on the "local" keyword on my first line;

local ddb = import 'ddb.docker.libjsonnet';
RUNTIME ERROR: Undefined external variable: core.env.available
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:42:29-61    thunk <_core_env_available> from <$>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:376:35-54   thunk from <thunk <indexes> from <function <envIndex>>>
    <std>:1636:21-24    thunk from <function <anonymous>>
    <std>:32:25-26  thunk from <function <anonymous>>
    <std>:32:16-27  function <anonymous>
    <std>:1636:9-25 function <anonymous>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:376:21-55   thunk <indexes> from <function <envIndex>>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:377:33-40   thunk from <thunk <index> from <function <envIndex>>>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:377:22-41   thunk <index> from <function <envIndex>>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:378:5-10    function <envIndex>
    ...
    <std>:1545:21-22    thunk from <function <anonymous>>
    <std>:1545:5-33 function <anonymous>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:165:9-43    function <apply_docker_compose_included_services>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:272:62-148  thunk from <thunk from <function <Compose>>>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:175:2-9 function <apply_resolve_ports_conflicts>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:272:32-149  thunk from <function <Compose>>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:177:44-50   function <apply_default_network_name>
    C:\workspace\tools\libjsonnet\ddb.docker.libjsonnet:272:5-150   function <Compose>
    C:\workspace\projects\THE-PROJECT\docker-compose.yml.jsonnet:(9:1)-(99:3)   $
    During evaluation   

OK, that might not be a real issue, and I should probably set every std.extVar value I plan to use in the extension configuration, that's no my main concern.

When I try to ctrl+click on the file name on that line, it opens an editor to my project root (C:\workspace\projects\THE-PROJECT), with that message: image

I suspect there is something off with the path handling of windows, but I don't know what to debug. The only thing I get is this:

time="2023-08-16T17:16:59+02:00" level=info msg="configuration updated: {ResolvePathsWithTanka:false JPaths:[C:/workspace/tools/libjsonnet] ExtVars:map[] ExtCode:map[] FormattingOptions:{Indent:2 MaxBlankLines:2 StringStyle:1 CommentStyle:1 PrettyFieldNames:true PadArrays:false PadObjects:true SortImports:true UseImplicitPlus:true StripEverything:false StripComments:false StripAllButComments:false} EnableEvalDiagnostics:true EnableLintDiagnostics:false}"
time="2023-08-16T17:17:02+02:00" level=error msg="Hover: error parsing the document"

Any idea of what I need to do ?

EDIT: I tried with tanka enabled and disabled (with a full vs code restart in-between) and it behaves in the same way, except that I have a more verbose "unable to identify the project root" with tanka enabled.