Files
windmill/frontend/src/lib/components/monacoLanguagesOptions.ts
T
hugocasa 468aa230e5 refactor: resolve workspace imports via /f/,/u/ not $f/,$u/ aliases (#9438)
* refactor: resolve workspace imports via /f/,/u/ not $f/,$u/ aliases

Keep the CLI managed tsconfig.wmill.json / `refresh tsconfig` / Deno
import-map QoL from #9378, but re-key it on the existing /f/,/u/ workspace
paths instead of the new $f/,$u/ specifiers. Verified /f/,/u/ resolves in
tsc, Bun, Deno, the in-app ATA editor, and the worker, so the $-prefixed
alias added no value. Drop the $f/,$u/ handling from the parser, dep-map,
deno_executor, bun loaders, ATA, relative_imports and monaco paths; revert
the windmill-parser-wasm-ts bump (1.714.0 -> 1.695.0). Also fold in the
cli/package-lock.json sync for the already-committed pg-gateway dependency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: drop duplicate relative-path check and restore rustfmt formatting

Follow-up cleanups to the previous commit's full-file reverts, which
restored pre-#9378 state that main had since improved:

- relative_imports.ts: remove the redundant duplicate d.startsWith('/')
  (pre-#9378 had it; #9378 had repurposed that line, so main has no dup).
- windmill-parser-ts/src/lib.rs: restore the multi-line new_source_file(...)
  formatting required by backend/rustfmt.toml (the single-line revert would
  fail `cargo fmt --check`). Now differs from main only by the $f//$u/ removal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 17:27:24 +00:00

126 lines
3.1 KiB
TypeScript

import processStdContent from '$lib/process.d.ts.txt?raw'
import { jsonDefaults } from '@codingame/monaco-vscode-standalone-json-language-features'
import {
javascriptDefaults,
JsxEmit,
ModuleResolutionKind,
ScriptTarget,
typescriptDefaults
} from '@codingame/monaco-vscode-standalone-typescript-language-features'
let jsonInitialized = false
export function setMonacoJsonOptions() {
if (jsonInitialized) return
jsonInitialized = true
jsonDefaults.setDiagnosticsOptions({
validate: true,
allowComments: false,
schemas: [],
enableSchemaRequest: true
})
jsonDefaults.setModeConfiguration({
documentRangeFormattingEdits: false,
documentFormattingEdits: true,
hovers: true,
completionItems: true,
documentSymbols: true,
tokens: true,
colors: true,
foldingRanges: true,
selectionRanges: true,
diagnostics: true
})
}
let typescriptInitialized = false
export function setMonacoTypescriptOptions() {
if (typescriptInitialized) return
typescriptInitialized = true
typescriptDefaults.addExtraLib(processStdContent, 'process.d.ts')
typescriptDefaults.setModeConfiguration({
completionItems: true,
hovers: true,
documentSymbols: true,
definitions: true,
references: true,
documentHighlights: true,
rename: true,
diagnostics: true,
documentRangeFormattingEdits: true,
signatureHelp: true,
onTypeFormattingEdits: true,
codeActions: true,
inlayHints: true
})
// languages.typescript.javascriptDefaults.setEagerModelSync(true)
typescriptDefaults.setEagerModelSync(true)
// languages.typescript.javascriptDefaults.setDiagnosticsOptions({
// noSemanticValidation: false,
// noSyntaxValidation: false,
// noSuggestionDiagnostics: false,
// diagnosticCodesToIgnore: [1108]
// })
typescriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntaxValidation: false,
noSuggestionDiagnostics: false,
diagnosticCodesToIgnore: [1108, 7006, 7034, 7019, 7005]
})
typescriptDefaults.setCompilerOptions({
target: ScriptTarget.Latest,
allowNonTsExtensions: true,
noSemanticValidation: false,
noSyntaxValidation: false,
completionItems: true,
hovers: true,
documentSymbols: true,
definitions: true,
references: true,
documentHighlights: true,
rename: true,
diagnostics: true,
documentRangeFormattingEdits: true,
signatureHelp: true,
onTypeFormattingEdits: true,
codeActions: true,
inlayHints: true,
checkJs: true,
allowJs: true,
noUnusedLocals: true,
strict: true,
noLib: false,
allowImportingTsExtensions: true,
allowSyntheticDefaultImports: true,
moduleResolution: ModuleResolutionKind.NodeJs,
jsx: JsxEmit.React
})
}
let javascriptInitialized = false
export function setMonacoJavascriptOptions() {
if (javascriptInitialized) return
javascriptInitialized = true
javascriptDefaults.setCompilerOptions({
target: ScriptTarget.Latest,
allowNonTsExtensions: true,
noSemanticValidation: false,
noLib: true,
moduleResolution: ModuleResolutionKind.NodeJs
})
javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntaxValidation: false,
noSuggestionDiagnostics: false,
diagnosticCodesToIgnore: [1108]
})
}