Skip to content

fix: correct compile target and path resolution for multifile diagnostics - #540

Closed
metif12 wants to merge 8 commits into
vlang:masterfrom
metif12:fix/recognize-missing-compat-compiler
Closed

metif12 wants to merge 8 commits into
vlang:masterfrom
metif12:fix/recognize-missing-compat-compiler

Conversation

@metif12

@metif12 metif12 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Fixes multifile diagnostics by using compile_target as the execution and diagnostic source directory, adding base_dir parameter to source_path_from_overlay for correct relative path resolution, escaping backslashes in JSON rootPath for Windows paths, and fixing u64 to int conversion in test file size calculations.

metif12 and others added 6 commits October 3, 2026 15:16
…iler

Hover, completion, signature help, and go to definition all go through
`v -vls-mode -line-info`, which the V launcher routes to the V1
compatibility compiler. When that compiler is missing, the launcher
refuses with a single line and exits:

    `-vls-mode` requires the compatibility compiler, but no usable V
    0.5.2 fallback was found and make is unavailable. Install make,
    then run `make v1` in `C:\Users\me\v`.

That refusal is not an "unknown option" line, so neither
`compiler_rejects_line_info` nor `compiler_refused_and_stopped`
recognized it. `line_info_mode` stayed `.direct`, so VLS kept spawning
the compiler once per request for an answer that can never arrive, and
every one of those lookups resolved to empty with nothing said about why.

Recognize the refusal, retire the lookups as `.missing` so they are
answered from VLS's own index instead of paying a process launch each,
and tell the user what to install. A launcher that can build the
fallback itself announces "running `make v1` now" and then answers, so
that form is explicitly not a dead end.

The notice needs no "already warned" flag: the caller sets
`line_info_mode` to `.missing` first, and from then on `run_v_line_info`
returns from its early `.missing` check without reaching this point, so
it is sent at most once per session.
vlang/v#29369 (merged as 76d88b9) rewrites the tail of the launcher's refusal:
the sentence after "make is unavailable" is now a platform-specific hint, and
the comma became a period. On Windows the clause reads

    On Windows, install GNU make in MSYS2 (`make` or `mingw32-make`) and put
    its tools, including `sh`, on PATH.

and elsewhere it is still "Install make.".

`compiler_lacks_compatibility_compiler` keys on "requires the compatibility
compiler", which both spellings contain, so detection is unaffected. This test
pinned the old wording verbatim, so it now asserts both: green before the
compiler change and after it, and the coupling is written down instead of being
rediscovered the next time the wording shifts.

Validated against V 0.5.2 76d88b9, the merged compiler: the Windows sample above
is its output verbatim. `interop_test.v` passes; the module suite reports the
same 3 failures with and without this change - `index_test.v`, `handlers_test.v`
and `integration_test.v`, none of them in this file. `integration_test.v` fails
on an empty completion list, which is the symptom of the missing V1 fallback
this refusal describes, and is what vlang/v#29369 and vlang/vscode-vlang#543 are
about.
…tics

- Use compile_target as exec_dir and diagnostic_source_dir so the
  compiler checks the correct module directory
- Add base_dir parameter to source_path_from_overlay so relative
  paths resolve against the compile target, not the project root
- Escape backslashes in JSON rootPath for Windows paths
- Fix u64 to int conversion in test file size calculations
When the 'v' on PATH is a forwarding wrapper (v.bat -> v.exe),
find_v_dir returned the wrapper directory, so vlib module lookups
(os, builtin, time, strings) resolved nowhere and indexed member
completions came back empty. Unwrap .bat/.cmd shims to their quoted
executable target in resolve_v_compiler_exe and cover it with tests.
@JalonSolov

Copy link
Copy Markdown
Contributor
Error: vls/interop.v:2554:61: error: undefined ident: `compile_target`

@JalonSolov

Copy link
Copy Markdown
Contributor

@JalonSolov

JalonSolov commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Hrm...

FAIL  [ 1/13] C: 11997.947 ms, R: 26059.912 ms vls/index_test.v
Too many retries in GC_alloc_large

on Windows.

@metif12 metif12 closed this Oct 9, 2026
@metif12

metif12 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing this in favour of #546.

Rebasing this branch onto current master turned every conflict in
compiler_lacks_compatibility_compiler into the same thing: the newer
upstream work already implements this, with more cases (fallback build
announcements that later fail, -old-compiler retries, platform specific
"make is unavailable" hints) and matching tests. What was left after that
— the launcher shim resolution, the compile_target threading, and the
wrapper fixture — is already part of #546's diff against master (verified
by diffing feat/tiered-diagnostics against master and finding
resolve_wrapper_target and the compile_target plumbing there).

So one PR, #546, carries this work plus the rest, rather than a chain of
five where the middle ones are mostly superseded. #547 covers the Windows
CI abort separately, since that one is small enough to review on its own.

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

Successfully merging this pull request may close these issues.

2 participants