Skip to content

Commit 7405338

Browse files
committed
fix: Conversion to XML in VSCode web
1 parent d903acb commit 7405338

4 files changed

Lines changed: 18 additions & 23 deletions

File tree

package-lock.json

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"capabilities": {
3737
"virtualWorkspaces": {
3838
"supported": true,
39-
"description": "DropEdit and file conversion to CSON/XML do not work in VSCode Web"
39+
"description": "DropEdit and file conversion to CSON does not work in VSCode Web"
4040
},
4141
"untrustedWorkspaces": {
4242
"supported": true,
@@ -669,8 +669,7 @@
669669
"command": "textmate.convertFileToXML",
670670
"title": "Convert file to XML",
671671
"category": "TextMate",
672-
"icon": "assets/TextMate-file-icon.svg",
673-
"enablement": "!isWeb"
672+
"icon": "assets/TextMate-file-icon.svg"
674673
},
675674
{
676675
"command": "textmate.convertFileToASCII",
@@ -694,7 +693,7 @@
694693
"date-and-time": "3.6.0",
695694
"oniguruma-parser-cjs": "^0.0.1",
696695
"oniguruma-to-es": "^4.3.5",
697-
"plist": "^3.1.0",
696+
"plist": "^4.0.0",
698697
"vscode-onigmo": "^2.0.1",
699698
"vscode-oniguruma": "1.7.0",
700699
"web-tree-sitter": "file:node_modules_linked/web-tree-sitter",

src/fileConverter.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ async function convertFileTo(newLanguage: Language, document?: vscode.TextDocume
9292
});
9393
break;
9494
case 'XML':
95-
if (typeof navigator !== 'undefined') {
96-
throw new Error("TextMate: Conversion to XML is not available in VSCode Web atm");
97-
}
9895
newText = XML.build(parsedDocument, { indent: indent });
9996
break;
10097
case 'ASCII':

src/test/suite/extension.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,17 @@ suite('Extension Tests', async () => {
272272
await assertFileConversion('JSON.tmLanguage.json', 'textmate.convertFileToJSON');
273273
await assertFileConversion('YAML.tmLanguage.yaml', 'textmate.convertFileToYAML');
274274
await assertFileConversion('ASCII.textmate', 'textmate.convertFileToASCII');
275+
await assertFileConversion('XML.tmLanguage', 'textmate.convertFileToXML');
275276

276-
// TODO: Conversion to XML/CSON doesn't work in VSCode Web atm
277+
// TODO: Conversion to CSON doesn't work in VSCode Web atm
277278
if (typeof navigator === 'object') {
278279
// TODO: Conversion from CSON is buggy. skipping test
279280
// https://github.com/fabiospampinato/cson2json/issues/1
280281
// await testFileConversion('CSON.tmLanguage.cson', 'textmate.convertFileToJSON', 'JSON.tmLanguage.json');
281-
await assertFileConversion('XML.tmLanguage', 'textmate.convertFileToJSON', 'JSON.tmLanguage.json');
282-
283282
return;
284283
}
285284

286285
await assertFileConversion('CSON.tmLanguage.cson', 'textmate.convertFileToCSON');
287-
await assertFileConversion('XML.tmLanguage', 'textmate.convertFileToXML');
288286
});
289287

290288
test('FormatDocumentProvider', async () => {

0 commit comments

Comments
 (0)