Skip to content

Commit a54ebde

Browse files
committed
Revert "Adjust to switch of formatter implementation from prettier to yaml"
This reverts commit 6dc8906.
1 parent bdaa1cf commit a54ebde

4 files changed

Lines changed: 5 additions & 31 deletions

File tree

.vscodeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ CONTRIBUTING.md
2121
**/**.vsix
2222
**/**.tar.gz
2323
test-resources
24+
!node_modules/prettier/index.js
25+
!node_modules/prettier/third-party.js
26+
!node_modules/prettier/parser-yaml.js

smoke-test/smoke.test.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ describe('Smoke test suite', function () {
1010

1111
const SCHEMA_INSTANCE_NAME = 'references-schema.yaml';
1212
const THROUGH_SETTINGS_NAME = 'references-schema-settings.yaml';
13-
const UNFORMATTED_NAME = 'unformatted.yaml';
1413

1514
let schemaInstanceUri: URI;
1615
let throughSettingsUri: URI;
17-
let unformattedUri: URI;
1816

1917
before(async function () {
2018
if (vscode.workspace.workspaceFolders === undefined) {
@@ -27,9 +25,6 @@ describe('Smoke test suite', function () {
2725
throughSettingsUri = workspaceUri.with({
2826
path: workspaceUri.path + (workspaceUri.path.endsWith('/') ? '' : '/') + THROUGH_SETTINGS_NAME,
2927
});
30-
unformattedUri = workspaceUri.with({
31-
path: workspaceUri.path + (workspaceUri.path.endsWith('/') ? '' : '/') + UNFORMATTED_NAME,
32-
});
3328
});
3429

3530
it('has right diagnostics when schema is referenced through a comment', async function () {
@@ -51,28 +46,4 @@ describe('Smoke test suite', function () {
5146
assert.strictEqual(diagnostics.length, 1);
5247
assert.strictEqual(diagnostics[0].message, 'Value is below the minimum of 0.');
5348
});
54-
55-
it('has right formatting', async function () {
56-
const textDocument = await vscode.workspace.openTextDocument(unformattedUri);
57-
await vscode.window.showTextDocument(textDocument);
58-
59-
// heavily borrowed from prettier's test suite
60-
const edits = await vscode.commands.executeCommand<vscode.TextEdit[]>(
61-
'vscode.executeFormatDocumentProvider',
62-
textDocument.uri,
63-
{ tabSize: 2, insertSpaces: true }
64-
);
65-
66-
if (edits && edits.length > 0) {
67-
const workspaceEdit = new vscode.WorkspaceEdit();
68-
workspaceEdit.set(textDocument.uri, edits);
69-
await vscode.workspace.applyEdit(workspaceEdit);
70-
}
71-
72-
const EXPECTED = `aaa:
73-
bbb: hjkl
74-
`;
75-
76-
assert.strictEqual(textDocument.getText(), EXPECTED);
77-
});
7849
});

smoke-test/unformatted.yaml

Lines changed: 0 additions & 2 deletions
This file was deleted.

webpack.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const config = {
3131
devtool: 'source-map',
3232
externals: {
3333
vscode: 'commonjs vscode', // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
34+
prettier: 'commonjs prettier',
3435
},
3536
resolve: {
3637
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
@@ -135,6 +136,7 @@ const serverWeb = {
135136
mainFields: ['browser', 'module', 'main'],
136137
extensions: ['.ts', '.js'], // support ts-files and js-files
137138
alias: {
139+
'./services/yamlFormatter': path.resolve(__dirname, './build/polyfills/yamlFormatter.js'), // not supported for now. prettier can run in the web, but it's a bit more work.
138140
'vscode-json-languageservice/lib/umd': 'vscode-json-languageservice/lib/esm',
139141
},
140142
fallback: {

0 commit comments

Comments
 (0)