nim-lang / nimsuggest

idetools for the nim language
MIT License
42 stars 9 forks source link

False negative on buildHtml in Karax #112

Open moigagoo opened 4 years ago

moigagoo commented 4 years ago

nimsuggest reports an error even with the simplest Karax code, simply if buildHtml is called:

import karax/[karax, karaxdsl, vdom]

proc render(): VNode =
  buildHtml(tdiv):
    p:
      text "hello"

setRenderer render

Nimsuggest output:

$ nimsuggest.exe root.nim
Hint: used config file 'C:\Users\moigagoo\.choosenim\toolchains\nim-1.0.4\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\moigagoo\Projects\chyatik\public\root.nim.cfg' [Conf]
usage: sug|con|def|use|dus|chk|mod|highlight|outline|known file.nim[;dirtyfile.nim]:line:col
type 'quit' to quit
type 'debug' to toggle debug mode on/off
type 'terse' to toggle terse mode on/off
> chk root.nim
chk     skUnknown               Hint    ???     0       -1      "root [Processing]"     0
chk     skUnknown               Error   C:\Users\moigagoo\Projects\chyatik\public\root.nim      5       11      "template/generic instantiation from here"      0
chk     skUnknown               Error   C:\Users\moigagoo\.nimble\pkgs\karax-1.1.0\karax\karaxdsl.nim   75      6      "cannot generate VM code for result"     0
moigagoo commented 4 years ago

Original issue: https://github.com/pragmagic/karax/issues/131

saem commented 3 years ago

If I specify the --backend:js and -d:js parameters everything works fine, tested with:

This has a work around, extension authors can help here by passing the backend parameter -- this is done in the nim vscode plugin, but not the TS plugin, IIRC.

My thoughts on a more meaningful fix are as follows, if nimsuggest is going to treat the nimble file as a project file, then it should be more nimble aware an get the backend from there. Alternatively, if nimble is going to track this information then it should be more nimsuggest aware and provide a properly configured nimsuggest instance that it can launch for the user or an editor.

saem commented 3 years ago

A workaround(?) for this would be to have the user specify the params in a nim.cfg or $project.nim.cfg.