Skip to content

Commit

Permalink
Merge pull request #28 from CodinGame/fix-theme-loading-windows
Browse files Browse the repository at this point in the history
Never use file uris
  • Loading branch information
CGNonofr authored Apr 19, 2022
2 parents 7fc19cd + b45bc1a commit 6fdf5eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/languages/textMate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ function createGrammarFactory (): CGTMGrammarFactory {
const parsedGrammars = (rawGrammars as unknown as Omit<monaco.extra.ITMSyntaxExtensionPoint, 'path'>[])
.map(grammar => ({
...monaco.extra.parseTextMateGrammar(grammar as monaco.extra.ITMSyntaxExtensionPoint, languageService),
location: monaco.Uri.file(grammar.scopeName + '.json')
location: monaco.Uri.from({
scheme: 'browser',
path: grammar.scopeName + '.json'
})
}))

return new CGTMGrammarFactory(
Expand Down
6 changes: 5 additions & 1 deletion src/theme/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export async function defineVSCodeTheme (
extensionData?: Partial<monaco.extra.ExtensionData>
): Promise<void> {
const path = `/theme-${id}.json`
const rootUri = monaco.Uri.file(themeExtensionPoint?.path?.slice(1) ?? path)
// Do not use `file` scheme or monaco will replace `/` by `\` on windows
const rootUri = monaco.Uri.from({
scheme: 'browser',
path: themeExtensionPoint?.path?.slice(1) ?? path
})
const themeData = monaco.extra.ColorThemeData.fromExtensionTheme({
id,
path: path,
Expand Down

0 comments on commit 6fdf5eb

Please sign in to comment.