VS Code extension 0.5.0: use imports fail on Windows (drive letter encoded as c%3A)

Environment

  • dbdiagram VS Code extension 0.5.0 (the first release with multi-file support, 2026-10-12)
  • VS Code 1.140.0, Windows 11 x64
  • All .dbml files are in the same local folder (C:\Users\<user>\Downloads\gold_dw3\)

Steps to reproduce

  1. Create simulado_references.dbml with Table DW3_DIM_CLD_DY { ID_CLD_DY date [pk] }.
  2. In the same folder, create model.dbml:
use {
  table DW3_DIM_CLD_DY
} from './simulado_references.dbml'

Table FACT { ID_CLD_DY date }
Ref: FACT.ID_CLD_DY > DW3_DIM_CLD_DY.ID_CLD_DY
  1. Open model.dbml in VS Code.

Expected: The import resolves and the Ref is valid. The same files pass validation with a separate DBML linter that resolves use imports.

Actual:

Failed to resolve the non-existent file './simulado_references.dbml'
Table 'DW3_DIM_CLD_DY' does not exist in file /simulado_references.dbml. Does the file exist?
Column 'ID_CLD_DY' does not exist in Table 'DW3_DIM_CLD_DY'

The file is looked up at /simulado_references.dbml, the filesystem root, instead of the document’s folder.

Root cause (from the bundled dist/extension.js) processDocument passes document.fileName (c:\Users\...\model.dbml) to FilePath.from(). The FilePath constructor runs encodeURIComponent on every /-separated segment, so the drive letter c: becomes c%3A and backslashes become %5C. The resulting path is no longer recognized as absolute. I extracted the FilePath class from the bundle and ran it with VS Code’s Node runtime:

FilePath.from('c:\\Users\\me\\gold_dw3\\model.dbml')
  -> Error: FilePath requires an absolute path, got: "c%3A%5CUsers%5Cme%5Cgold_dw3%5Cmodel.dbml"
FilePath.from('c:/Users/me/gold_dw3/model.dbml')
  -> Error: FilePath requires an absolute path, got: "c%3A/Users/me/gold_dw3/model.dbml"
FilePath.from('/c:/Users/me/gold_dw3/model.dbml')       // ok -> /c%3A/Users/...
  .resolve('./simulado_references.dbml')
  -> Error: FilePath requires an absolute path, got: "c%3A/Users/me/gold_dw3/simulado_references.dbml"

Every relative use import fails on Windows local paths, whatever folder the files are in. Suggested fix: convert document.uri to a POSIX-style path before building FilePath (for example /c:/Users/...), and keep the : after a drive letter unencoded. statSync should also receive fsPath, not the encoded absolute path.

Hi @MAIKOL_JUNIOR_LOPEZ, thank you for the detailed report! We’re currently working on it to deploy a fix soon. We’ll get back to you when a fix is released.

1 Like

There is a diagram showing the related issue in version 5.