Skip to content

Commit b45bc1a

Browse files
committed
fix: Never use file uris
1 parent 7fc19cd commit b45bc1a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/languages/textMate/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ function createGrammarFactory (): CGTMGrammarFactory {
1111
const parsedGrammars = (rawGrammars as unknown as Omit<monaco.extra.ITMSyntaxExtensionPoint, 'path'>[])
1212
.map(grammar => ({
1313
...monaco.extra.parseTextMateGrammar(grammar as monaco.extra.ITMSyntaxExtensionPoint, languageService),
14-
location: monaco.Uri.file(grammar.scopeName + '.json')
14+
location: monaco.Uri.from({
15+
scheme: 'browser',
16+
path: grammar.scopeName + '.json'
17+
})
1518
}))
1619

1720
return new CGTMGrammarFactory(

src/theme/registry.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ export async function defineVSCodeTheme (
5454
extensionData?: Partial<monaco.extra.ExtensionData>
5555
): Promise<void> {
5656
const path = `/theme-${id}.json`
57-
const rootUri = monaco.Uri.file(themeExtensionPoint?.path?.slice(1) ?? path)
57+
// Do not use `file` scheme or monaco will replace `/` by `\` on windows
58+
const rootUri = monaco.Uri.from({
59+
scheme: 'browser',
60+
path: themeExtensionPoint?.path?.slice(1) ?? path
61+
})
5862
const themeData = monaco.extra.ColorThemeData.fromExtensionTheme({
5963
id,
6064
path: path,

0 commit comments

Comments
 (0)