@effect/language-service 0.1.0 → 0.2.0

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.
Files changed (2) hide show
  1. package/index.cjs +66 -0
  2. package/package.json +1 -1
package/index.cjs CHANGED
@@ -424,6 +424,21 @@ function compareBoth(self, that) {
424
424
  }
425
425
  var isEqual = (u) => hasProperty(u, symbol2);
426
426
 
427
+ // node_modules/.pnpm/effect@2.0.0-next.59/node_modules/effect/dist/esm/Equivalence.js
428
+ var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
429
+ var array = (item) => make((self, that) => {
430
+ if (self.length !== that.length) {
431
+ return false;
432
+ }
433
+ for (let i = 0; i < self.length; i++) {
434
+ const isEq = item(self[i], that[i]);
435
+ if (!isEq) {
436
+ return false;
437
+ }
438
+ }
439
+ return true;
440
+ });
441
+
427
442
  // node_modules/.pnpm/effect@2.0.0-next.59/node_modules/effect/dist/esm/Inspectable.js
428
443
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
429
444
  var toJSON = (x) => {
@@ -622,16 +637,29 @@ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nu
622
637
  var map = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
623
638
  var flatMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(self.value));
624
639
 
640
+ // node_modules/.pnpm/effect@2.0.0-next.59/node_modules/effect/dist/esm/internal/readonlyArray.js
641
+ var isNonEmptyArray = (self) => self.length > 0;
642
+
625
643
  // node_modules/.pnpm/effect@2.0.0-next.59/node_modules/effect/dist/esm/ReadonlyArray.js
626
644
  var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
627
645
  var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
628
646
  var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
647
+ var isNonEmptyReadonlyArray = isNonEmptyArray;
629
648
  var isOutOfBound = (i, as) => i < 0 || i >= as.length;
630
649
  var get = /* @__PURE__ */ dual(2, (self, index) => {
631
650
  const i = Math.floor(index);
632
651
  return isOutOfBound(i, self) ? none2() : some2(self[i]);
633
652
  });
653
+ var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
654
+ const i = Math.floor(index);
655
+ if (isOutOfBound(i, self)) {
656
+ throw new Error(`Index ${i} out of bounds`);
657
+ }
658
+ return self[i];
659
+ });
634
660
  var head = /* @__PURE__ */ get(0);
661
+ var headNonEmpty = /* @__PURE__ */ unsafeGet(0);
662
+ var tailNonEmpty = (self) => self.slice(1);
635
663
  var empty = () => [];
636
664
  var map2 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
637
665
  var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
@@ -644,6 +672,37 @@ var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
644
672
  }
645
673
  return out;
646
674
  });
675
+ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
676
+ const input = fromIterable(self);
677
+ if (isNonEmptyReadonlyArray(input)) {
678
+ const out = [headNonEmpty(input)];
679
+ const rest = tailNonEmpty(input);
680
+ for (const r of rest) {
681
+ if (out.every((a) => !isEquivalent(r, a))) {
682
+ out.push(r);
683
+ }
684
+ }
685
+ return out;
686
+ }
687
+ return [];
688
+ });
689
+
690
+ // src/quickinfo.ts
691
+ var SymbolDisplayPartEq = make(
692
+ (fa, fb) => fa.kind === fb.kind && fa.text === fb.text
693
+ );
694
+ var JSDocTagInfoEq = make(
695
+ (fa, fb) => fa.name === fb.name && typeof fa.text === typeof fb.text && (typeof fa.text !== "undefined" ? array(SymbolDisplayPartEq)(fa.text, fb.text) : true)
696
+ );
697
+ function dedupeJsDocTags(quickInfo) {
698
+ if (quickInfo.tags) {
699
+ return {
700
+ ...quickInfo,
701
+ tags: dedupeWith(quickInfo.tags, JSDocTagInfoEq)
702
+ };
703
+ }
704
+ return quickInfo;
705
+ }
647
706
 
648
707
  // src/definition.ts
649
708
  function createRefactor(definition) {
@@ -1450,6 +1509,13 @@ var init = (modules) => {
1450
1509
  ...args
1451
1510
  );
1452
1511
  };
1512
+ proxy.getQuickInfoAtPosition = (fileName, position, ...args) => {
1513
+ const quickInfo = languageService.getQuickInfoAtPosition(fileName, position, ...args);
1514
+ if (quickInfo) {
1515
+ return dedupeJsDocTags(quickInfo);
1516
+ }
1517
+ return quickInfo;
1518
+ };
1453
1519
  return proxy;
1454
1520
  }
1455
1521
  return { create };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/language-service",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A Language-Service Plugin to Refactor and Diagnostic effect-ts projects",
5
5
  "main": "index.cjs",
6
6
  "repository": {