You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have a CLI switch like --actualfile which specifies the file that the input represents. Then all error messages and resolving config files will use that file path instead
Description
For tooling based on nim check its easier to store the file in memory and pass it via stdin. This has a few limitations
Error messages report as being from stdinfile.nim and so need to be converted before being shown to the user
Config files that are $file.nims are not loaded
currentSourcePath() returns stdinfile.nim so checking code that uses files relative to the source file always fails
The flag should make the compiler treat the input as coming from an actual file and use that when referencing to errors inside the input and resolving other files like configs
Alternatives
The Nim compiler API could be used instead but this has the problems of
Not being able to cancel checking as easily as just killing a process
Tooling is then linked to the version of Nim that it was built with, user then has to recompile every Nim update
Also could use nimsuggest which supports a dirtyfile flag, but issues like #24413 make it a pain
Examples
echo "something()" | nim check --actualfile:foo.nim -
Summary
Have a CLI switch like
--actualfile
which specifies the file that the input represents. Then all error messages and resolving config files will use that file path insteadDescription
For tooling based on
nim check
its easier to store the file in memory and pass it via stdin. This has a few limitationsstdinfile.nim
and so need to be converted before being shown to the user$file.nims
are not loadedcurrentSourcePath()
returnsstdinfile.nim
so checking code that uses files relative to the source file always failsThe flag should make the compiler treat the input as coming from an actual file and use that when referencing to errors inside the input and resolving other files like configs
Alternatives
The Nim compiler API could be used instead but this has the problems of
Also could use nimsuggest which supports a
dirtyfile
flag, but issues like #24413 make it a painExamples
echo "something()" | nim check --actualfile:foo.nim -
echo "something()" | nim check --actualfile:/absolute.nim -
Backwards Compatibility
Shouldn't cause any problems
Links
No response
The text was updated successfully, but these errors were encountered: