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

Suggestion doesn't work in templates defined outside the file #42

Open
faldor20 opened this issue Jun 17, 2023 · 2 comments
Open

Suggestion doesn't work in templates defined outside the file #42

faldor20 opened this issue Jun 17, 2023 · 2 comments

Comments

@faldor20
Copy link

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

@yyoncho
Copy link
Collaborator

yyoncho commented Jun 17, 2023

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

@faldor20
Copy link
Author

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

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

2 participants