@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.
@@ -32,7 +32,7 @@ let __soda_gql_common_template_extraction = require("@soda-gql/common/template-e
32
32
  let graphql = require("graphql");
33
33
  let node_fs = require("node:fs");
34
34
  let node_path = require("node:path");
35
- let __soda_gql_codegen = require("@soda-gql/codegen");
35
+ let __soda_gql_tools_codegen = require("@soda-gql/tools/codegen");
36
36
  let neverthrow = require("neverthrow");
37
37
  let __soda_gql_config = require("@soda-gql/config");
38
38
  let vscode_languageserver_node = require("vscode-languageserver/node");
@@ -559,7 +559,7 @@ const loadAndBuildSchema = (schemaName, schemaPaths) => {
559
559
  }
560
560
  }
561
561
  const documentNode = (0, graphql.concatAST)(documents);
562
- const hash = (0, __soda_gql_codegen.hashSchema)(documentNode);
562
+ const hash = (0, __soda_gql_tools_codegen.hashSchema)(documentNode);
563
563
  const buildResult = safeBuildASTSchema(schemaName, documentNode);
564
564
  if (buildResult.isErr()) {
565
565
  return (0, neverthrow.err)(buildResult.error);
@@ -3566,33 +3566,14 @@ const handleFormatting = (input) => {
3566
3566
  const { templates, tsSource, formatGraphql } = input;
3567
3567
  const format = formatGraphql ?? defaultFormatGraphql;
3568
3568
  const tsLineOffsets = computeLineOffsets(tsSource);
3569
- const edits = [];
3570
- for (const template of templates) {
3571
- let formatted;
3572
- try {
3573
- formatted = format(template.content);
3574
- } catch {
3575
- continue;
3576
- }
3577
- if (formatted === template.content) {
3578
- continue;
3579
- }
3580
- const baseIndent = (0, __soda_gql_common_template_extraction.detectBaseIndent)(tsSource, template.contentRange.start);
3581
- const reindented = (0, __soda_gql_common_template_extraction.reindent)(formatted, baseIndent, template.content);
3582
- if (reindented === template.content) {
3583
- continue;
3584
- }
3585
- const start = offsetToPosition(tsLineOffsets, template.contentRange.start);
3586
- const end = offsetToPosition(tsLineOffsets, template.contentRange.end);
3587
- edits.push({
3588
- range: {
3589
- start,
3590
- end
3591
- },
3592
- newText: reindented
3593
- });
3594
- }
3595
- return edits;
3569
+ const templateEdits = (0, __soda_gql_common_template_extraction.formatTemplatesInSource)(templates, tsSource, format);
3570
+ return templateEdits.map((edit) => ({
3571
+ range: {
3572
+ start: offsetToPosition(tsLineOffsets, edit.start),
3573
+ end: offsetToPosition(tsLineOffsets, edit.end)
3574
+ },
3575
+ newText: edit.newText
3576
+ }));
3596
3577
  };
3597
3578
 
3598
3579
  //#endregion
@@ -4233,4 +4214,4 @@ Object.defineProperty(exports, 'preprocessFragmentArgs', {
4233
4214
  return preprocessFragmentArgs;
4234
4215
  }
4235
4216
  });
4236
- //# sourceMappingURL=server-BZEiUZua.cjs.map
4217
+ //# sourceMappingURL=server-DsJ1bZ7i.cjs.map