@soda-gql/lsp 0.12.6 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{server-6n4IOnC9.mjs → server-CqOUHwDk.mjs} +11 -30
- package/dist/server-CqOUHwDk.mjs.map +1 -0
- package/dist/{server-BZEiUZua.cjs → server-DsJ1bZ7i.cjs} +11 -30
- package/dist/server-DsJ1bZ7i.cjs.map +1 -0
- package/package.json +5 -5
- package/dist/server-6n4IOnC9.mjs.map +0 -1
- package/dist/server-BZEiUZua.cjs.map +0 -1
package/dist/bin.cjs
CHANGED
package/dist/bin.mjs
CHANGED
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as createDocumentManager, i as lspErrors, n as createSchemaResolver, o as preprocessFragmentArgs, r as createPositionMapper, t as createLspServer } from "./server-
|
|
1
|
+
import { a as createDocumentManager, i as lspErrors, n as createSchemaResolver, o as preprocessFragmentArgs, r as createPositionMapper, t as createLspServer } from "./server-CqOUHwDk.mjs";
|
|
2
2
|
|
|
3
3
|
export { createDocumentManager, createLspServer, createPositionMapper, createSchemaResolver, lspErrors, preprocessFragmentArgs };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
3
|
import { createSwcSpanConverter } from "@soda-gql/common";
|
|
4
|
-
import {
|
|
4
|
+
import { formatTemplatesInSource, walkAndExtract } from "@soda-gql/common/template-extraction";
|
|
5
5
|
import { TypeInfo, buildASTSchema, concatAST, getNamedType, isTypeDefinitionNode, parse, print, visit, visitWithTypeInfo } from "graphql";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { dirname, resolve, sep } from "node:path";
|
|
8
|
-
import { hashSchema } from "@soda-gql/codegen";
|
|
8
|
+
import { hashSchema } from "@soda-gql/tools/codegen";
|
|
9
9
|
import { err, ok } from "neverthrow";
|
|
10
10
|
import { findAllConfigFiles, findConfigFile, loadConfig } from "@soda-gql/config";
|
|
11
11
|
import { DidChangeWatchedFilesNotification, FileChangeType, ProposedFeatures, TextDocumentSyncKind, TextDocuments, createConnection } from "vscode-languageserver/node";
|
|
@@ -3538,33 +3538,14 @@ const handleFormatting = (input) => {
|
|
|
3538
3538
|
const { templates, tsSource, formatGraphql } = input;
|
|
3539
3539
|
const format = formatGraphql ?? defaultFormatGraphql;
|
|
3540
3540
|
const tsLineOffsets = computeLineOffsets(tsSource);
|
|
3541
|
-
const
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
}
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
if (formatted === template.content) {
|
|
3550
|
-
continue;
|
|
3551
|
-
}
|
|
3552
|
-
const baseIndent = detectBaseIndent(tsSource, template.contentRange.start);
|
|
3553
|
-
const reindented = reindent(formatted, baseIndent, template.content);
|
|
3554
|
-
if (reindented === template.content) {
|
|
3555
|
-
continue;
|
|
3556
|
-
}
|
|
3557
|
-
const start = offsetToPosition(tsLineOffsets, template.contentRange.start);
|
|
3558
|
-
const end = offsetToPosition(tsLineOffsets, template.contentRange.end);
|
|
3559
|
-
edits.push({
|
|
3560
|
-
range: {
|
|
3561
|
-
start,
|
|
3562
|
-
end
|
|
3563
|
-
},
|
|
3564
|
-
newText: reindented
|
|
3565
|
-
});
|
|
3566
|
-
}
|
|
3567
|
-
return edits;
|
|
3541
|
+
const templateEdits = formatTemplatesInSource(templates, tsSource, format);
|
|
3542
|
+
return templateEdits.map((edit) => ({
|
|
3543
|
+
range: {
|
|
3544
|
+
start: offsetToPosition(tsLineOffsets, edit.start),
|
|
3545
|
+
end: offsetToPosition(tsLineOffsets, edit.end)
|
|
3546
|
+
},
|
|
3547
|
+
newText: edit.newText
|
|
3548
|
+
}));
|
|
3568
3549
|
};
|
|
3569
3550
|
|
|
3570
3551
|
//#endregion
|
|
@@ -4170,4 +4151,4 @@ const positionToOffset = (source, position) => {
|
|
|
4170
4151
|
|
|
4171
4152
|
//#endregion
|
|
4172
4153
|
export { createDocumentManager as a, lspErrors as i, createSchemaResolver as n, preprocessFragmentArgs as o, createPositionMapper as r, createLspServer as t };
|
|
4173
|
-
//# sourceMappingURL=server-
|
|
4154
|
+
//# sourceMappingURL=server-CqOUHwDk.mjs.map
|