@effect/language-service 0.40.0 → 0.40.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/index.js CHANGED
@@ -3499,7 +3499,10 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
3499
3499
  ]
3500
3500
  );
3501
3501
  return ts.factory.createPropertyDeclaration(
3502
- [ts.factory.createModifier(ts.SyntaxKind.StaticKeyword)],
3502
+ [
3503
+ ts.factory.createModifier(ts.SyntaxKind.StaticKeyword),
3504
+ ts.factory.createModifier(ts.SyntaxKind.OverrideKeyword)
3505
+ ],
3503
3506
  propertyName,
3504
3507
  void 0,
3505
3508
  type,
@@ -3865,7 +3868,7 @@ var classSelfMismatch = createDiagnostic({
3865
3868
  );
3866
3869
  if (result) {
3867
3870
  const { className, selfTypeNode } = result;
3868
- let actualName = "";
3871
+ let actualName = sourceFile.text.substring(selfTypeNode.pos, selfTypeNode.end);
3869
3872
  if (ts.isTypeReferenceNode(selfTypeNode)) {
3870
3873
  if (ts.isIdentifier(selfTypeNode.typeName)) {
3871
3874
  actualName = ts.idText(selfTypeNode.typeName);
@@ -13694,45 +13697,56 @@ var init = (modules) => {
13694
13697
  }
13695
13698
  return applicableRenameInfo;
13696
13699
  };
13697
- info.session?.addProtocolHandler("_effectGetLayerMermaid", (arg) => {
13698
- const { character, line, path } = arg.arguments;
13699
- const normalizedPath = modules.typescript.server.toNormalizedPath(path);
13700
- const projectService = info.project.projectService;
13701
- const scriptInfo = projectService.getScriptInfoForNormalizedPath(normalizedPath);
13702
- if (scriptInfo) {
13703
- const targetProject = scriptInfo.getDefaultProject();
13704
- if (targetProject) {
13705
- const program = targetProject.getLanguageService().getProgram();
13706
- if (program) {
13707
- const sourceFile = targetProject.getSourceFile(scriptInfo.path);
13708
- if (sourceFile) {
13709
- return pipe(
13710
- effectApiGetLayerGraph(sourceFile, line, character),
13711
- map3((response) => ({
13712
- response: {
13713
- success: true,
13714
- ...response
13715
- }
13716
- })),
13717
- runNano(program),
13718
- getOrElse((e) => ({
13719
- response: {
13720
- success: false,
13721
- error: e.message
13722
- }
13723
- }))
13724
- );
13700
+ const additionalProtocolHandlers = {
13701
+ "_effectGetLayerMermaid": (arg) => {
13702
+ const { character, line, path } = arg.arguments;
13703
+ const normalizedPath = modules.typescript.server.toNormalizedPath(path);
13704
+ const projectService = info.project.projectService;
13705
+ const scriptInfo = projectService.getScriptInfoForNormalizedPath(normalizedPath);
13706
+ if (scriptInfo) {
13707
+ const targetProject = scriptInfo.getDefaultProject();
13708
+ if (targetProject) {
13709
+ const program = targetProject.getLanguageService().getProgram();
13710
+ if (program) {
13711
+ const sourceFile = targetProject.getSourceFile(scriptInfo.path);
13712
+ if (sourceFile) {
13713
+ return pipe(
13714
+ effectApiGetLayerGraph(sourceFile, line, character),
13715
+ map3((response) => ({
13716
+ response: {
13717
+ success: true,
13718
+ ...response
13719
+ }
13720
+ })),
13721
+ runNano(program),
13722
+ getOrElse((e) => ({
13723
+ response: {
13724
+ success: false,
13725
+ error: e.message
13726
+ }
13727
+ }))
13728
+ );
13729
+ }
13725
13730
  }
13726
13731
  }
13727
13732
  }
13733
+ return {
13734
+ response: {
13735
+ success: false,
13736
+ error: "No source file found"
13737
+ }
13738
+ };
13728
13739
  }
13729
- return {
13730
- response: {
13731
- success: false,
13732
- error: "No source file found"
13740
+ };
13741
+ if (info.session) {
13742
+ for (const [key, value] of Object.entries(additionalProtocolHandlers)) {
13743
+ try {
13744
+ info.session.addProtocolHandler(key, value);
13745
+ } catch (e) {
13746
+ info.project.log("[@effect/language-service] Skipped adding " + key + " protocol handler due to error: " + e);
13733
13747
  }
13734
- };
13735
- });
13748
+ }
13749
+ }
13736
13750
  return proxy;
13737
13751
  }
13738
13752
  return { create, onConfigurationChanged };