nim-lang/langserver

Suggestion doesn't work in templates defined outside the file

faldor20 opened this issue · 2 comments

When doing a suggestion in a template defined outside a file it doesn't suggest correctly.
mainFile.nim

import other

type TestData* = object
  testVal*:int

var state=TestData(testVal:100)

when isMainModule:
  echo("Hello, World!")

template template2*(blk: untyped): untyped =
  proc template2*()  =
    blk

proc procTest():int =
  #This works fine
  let otherState=state
  template2():
    let a=otherState.testVal
  template_outside():
    let a=otherState.testVal

  return state.testVal+1 


template_outside():
  #This doesn't complete correctly
  let a=state.testVal

other.nim

template template_outside*(blk: untyped): untyped =
  proc app_main*()  =
    blk

When inside template2(): state. provides the appropriate completion state.testVal
When inside template_outside completion doesn't work for state. or for otherState. the completion list simply shows all symbols
image
image

This sounds more like something to be reported in Nim repo as it is more likely nimsuggest bug/limitaiton.

I thought I'd start here, but I'll report it there too