Skip to content

Completion Fails for nested functions #129

@mahaffey

Description

@mahaffey

Version 0.13.1

Similar to: #113

Log

time="2023-11-16T11:47:36-08:00" level=info msg="Starting the language server"
time="2023-11-16T11:47:36-08:00" level=info msg="Initializing jsonnet-language-server version 0.13.1"
time="2023-11-16T11:47:36-08:00" level=info msg="Reading stdlib"
time="2023-11-16T11:47:36-08:00" level=info msg="configuration updated: {ResolvePathsWithTanka:true JPaths:[/<MYPATH>/lib/] 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-11-16T11:48:23-08:00" level=error msg="DocumentSymbol: error parsing the document"
time="2023-11-16T11:48:23-08:00" level=error msg="Completion: error finding ranges: field Critical() was not found in ast.DesugaredObject"
time="2023-11-16T11:48:24-08:00" level=error msg="DocumentSymbol: error parsing the document"
time="2023-11-16T11:48:41-08:00" level=error msg="Definition: error finding definition" error="cannot find definition"

Library

{

  // Stack Criticality modifiers
  Critical: function(warning_period=3) {
    critical: true,
    warning_period: warning_period,

    TimeZone: function(time_zone='America/Los_Angeles') self {
      timezone: time_zone,
    }
  },

  NonCritical: function() $.Critical() {
    critical: false,
  },
}

Live Configuration

local crit = import crit.libsonnet;

{
   test: crit.Critical().
                      // ^^^
                      // IntelliSense cannot resolve the nested function TimeZone, resulting in the error
                      // "Completion: error finding ranges: field Critical() was not found in ast.DesugaredObject"
                      //  however it can resolve both Critital and NonCritical on the local var/object crit
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions