Skip to content

Commit 94de813

Browse files
1 parent 632cc65 commit 94de813

File tree

76 files changed

+659
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+659
-169
lines changed

Source/Services/Handler/VscodeAPI/ExtensionsNamespace.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,33 @@ const ToExtensionObject = (Context: HandlerContext, Id: string, Raw: any) => {
253253
};
254254
};
255255

256+
// Registry entries whose key starts with `__` are provider/handler stashes
257+
// registered from WindowNamespace / WorkspaceNamespace (uriHandler,
258+
// fileDecorationProvider, terminalLinkProvider, terminalProfileProvider),
259+
// not real extension descriptions. Exclude them from the extensions.*
260+
// getters so ToExtensionObject isn't fed Raw = undefined on
261+
// extensionLocation — otherwise NormalizeLocation emits a WARN and returns
262+
// a bogus extension with empty path.
263+
const IsExtensionKey = (Key: string) => !Key.startsWith("__");
264+
256265
const CreateExtensionsNamespace = (Context: HandlerContext) => ({
257266
getExtension: (Identifier: string) => {
267+
if (!IsExtensionKey(Identifier)) return undefined;
258268
const Raw = Context.ExtensionRegistry.get(Identifier);
259269
return Raw ? ToExtensionObject(Context, Identifier, Raw) : undefined;
260270
},
261271
get all() {
262-
return [...Context.ExtensionRegistry.entries()].map(([Id, Raw]) =>
263-
ToExtensionObject(Context, Id, Raw),
264-
);
272+
return [...Context.ExtensionRegistry.entries()]
273+
.filter(([Id]) => IsExtensionKey(Id))
274+
.map(([Id, Raw]) => ToExtensionObject(Context, Id, Raw));
265275
},
266276
// Some extensions (html-language-features) iterate
267277
// `extensions.allAcrossExtensionHosts`; return the same array as `all`
268278
// so `for (...of...)` does not throw on `is not iterable`.
269279
get allAcrossExtensionHosts() {
270-
return [...Context.ExtensionRegistry.entries()].map(([Id, Raw]) =>
271-
ToExtensionObject(Context, Id, Raw),
272-
);
280+
return [...Context.ExtensionRegistry.entries()]
281+
.filter(([Id]) => IsExtensionKey(Id))
282+
.map(([Id, Raw]) => ToExtensionObject(Context, Id, Raw));
273283
},
274284
onDidChange: (Listener: () => void) => {
275285
Context.Emitter.on("deltaExtensions", Listener);

Source/Services/Handler/VscodeAPI/LanguagesNamespace.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ const CreateLanguagesNamespace = (
282282
createDiagnosticCollection: (Name?: string) => {
283283
const Owner = Name ?? "default";
284284
const Store = new Map<string, unknown[]>();
285+
// LSP clients (json-language-features and others) call `.clear()`
286+
// defensively on every doc-update cycle, which otherwise amplifies
287+
// to hundreds of Diagnostic.Clear RPCs per second for owner
288+
// `default`. Short-circuit when Store is already empty, and make
289+
// dispose() idempotent.
290+
let Disposed = false;
285291
return {
286292
name: Owner,
287293
set: (UriOrEntries: unknown, Diagnostics?: unknown[]) => {
@@ -314,6 +320,7 @@ const CreateLanguagesNamespace = (
314320
]).catch(() => {});
315321
},
316322
clear: () => {
323+
if (Store.size === 0) return;
317324
Store.clear();
318325
Context.MountainClient?.sendRequest("Diagnostic.Clear", [
319326
Owner,
@@ -334,6 +341,9 @@ const CreateLanguagesNamespace = (
334341
get: (Uri: unknown): unknown[] => Store.get(String(Uri)) ?? [],
335342
has: (Uri: unknown): boolean => Store.has(String(Uri)),
336343
dispose: () => {
344+
if (Disposed) return;
345+
Disposed = true;
346+
if (Store.size === 0) return;
337347
Store.clear();
338348
Context.MountainClient?.sendRequest("Diagnostic.Clear", [
339349
Owner,

Source/Services/MountainClientService.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,24 @@ message RPCDataPayload {
603603
Parameter: this.SerializeParameters(parameters),
604604
};
605605

606+
// BATCH-16 latency instrumentation: monotonic ns stamp at the
607+
// wire-send boundary. Mountain logs matching stamps on receive
608+
// and on final registration; diffing surfaces whether the
609+
// 700 ms observed in debug-electron boots is spent in gRPC
610+
// transport, Track dispatch, or inside the provider body.
611+
// Scoped to tree.register to keep unrelated RPCs quiet.
612+
if (method === "tree.register" && typeof process !== "undefined") {
613+
try {
614+
const Timestamp = process.hrtime.bigint().toString();
615+
const Correlation =
616+
(parameters?.[0] as { viewId?: string } | undefined)
617+
?.viewId ?? `req-${requestIdentifier}`;
618+
process.stdout.write(
619+
`[LandFix:Tree] wire-send method=${method} correlation=${Correlation} t=${Timestamp}\n`,
620+
);
621+
} catch {}
622+
}
623+
606624
// Execute with comprehensive retry logic and cancellation support
607625
const response = await this.SendRequestWithRetry(
608626
request,

Target/Bootstrap/Implementation/CocoonMain.js

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,6 +1727,17 @@ message RPCDataPayload {
17271727
Method: method,
17281728
Parameter: this.SerializeParameters(parameters)
17291729
};
1730+
if (method === "tree.register" && typeof process !== "undefined") {
1731+
try {
1732+
const Timestamp = process.hrtime.bigint().toString();
1733+
const Correlation = parameters?.[0]?.viewId ?? `req-${requestIdentifier}`;
1734+
process.stdout.write(
1735+
`[LandFix:Tree] wire-send method=${method} correlation=${Correlation} t=${Timestamp}
1736+
`
1737+
);
1738+
} catch {
1739+
}
1740+
}
17301741
const response = await this.SendRequestWithRetry(
17311742
request,
17321743
cancellationToken
@@ -17556,6 +17567,13 @@ function appendEscapedMarkdownCodeBlockFence(code, langId) {
1755617567
`${"`".repeat(desiredFenceLength)}`
1755717568
].join("\n");
1755817569
}
17570+
function appendEscapedMarkdownInlineCode(text) {
17571+
const longestBacktickRun = Math.max(0, ...(text.match(/`+/g) ?? []).map((m) => m.length));
17572+
const fence = "`".repeat(longestBacktickRun + 1);
17573+
const needsSpace = text.startsWith("`") || text.endsWith("`");
17574+
const content = needsSpace ? ` ${text} ` : text;
17575+
return `${fence}${content}${fence}`;
17576+
}
1755917577
function escapeDoubleQuotes(input) {
1756017578
return input.replace(/"/g, "&quot;");
1756117579
}
@@ -17692,6 +17710,8 @@ ${appendEscapedMarkdownCodeBlockFence(code, langId)}
1769217710
__name44(escapeMarkdownSyntaxTokens, "escapeMarkdownSyntaxTokens");
1769317711
__name(appendEscapedMarkdownCodeBlockFence, "appendEscapedMarkdownCodeBlockFence");
1769417712
__name44(appendEscapedMarkdownCodeBlockFence, "appendEscapedMarkdownCodeBlockFence");
17713+
__name(appendEscapedMarkdownInlineCode, "appendEscapedMarkdownInlineCode");
17714+
__name44(appendEscapedMarkdownInlineCode, "appendEscapedMarkdownInlineCode");
1769517715
__name(escapeDoubleQuotes, "escapeDoubleQuotes");
1769617716
__name44(escapeDoubleQuotes, "escapeDoubleQuotes");
1769717717
__name(removeMarkdownEscapes, "removeMarkdownEscapes");
@@ -25844,6 +25864,7 @@ var init_LanguagesNamespace = __esm({
2584425864
createDiagnosticCollection: /* @__PURE__ */ __name((Name) => {
2584525865
const Owner = Name ?? "default";
2584625866
const Store = /* @__PURE__ */ new Map();
25867+
let Disposed = false;
2584725868
return {
2584825869
name: Owner,
2584925870
set: /* @__PURE__ */ __name((UriOrEntries, Diagnostics) => {
@@ -25876,6 +25897,7 @@ var init_LanguagesNamespace = __esm({
2587625897
});
2587725898
}, "delete"),
2587825899
clear: /* @__PURE__ */ __name(() => {
25900+
if (Store.size === 0) return;
2587925901
Store.clear();
2588025902
Context21.MountainClient?.sendRequest("Diagnostic.Clear", [
2588125903
Owner
@@ -25891,6 +25913,9 @@ var init_LanguagesNamespace = __esm({
2589125913
get: /* @__PURE__ */ __name((Uri2) => Store.get(String(Uri2)) ?? [], "get"),
2589225914
has: /* @__PURE__ */ __name((Uri2) => Store.has(String(Uri2)), "has"),
2589325915
dispose: /* @__PURE__ */ __name(() => {
25916+
if (Disposed) return;
25917+
Disposed = true;
25918+
if (Store.size === 0) return;
2589425919
Store.clear();
2589525920
Context21.MountainClient?.sendRequest("Diagnostic.Clear", [
2589625921
Owner
@@ -26048,7 +26073,7 @@ var ExtensionsNamespace_exports = {};
2604826073
__export(ExtensionsNamespace_exports, {
2604926074
default: () => ExtensionsNamespace_default
2605026075
});
26051-
var NoopDisposable, MakeMultiStub, Stub, MakePermissiveExports, NormalizeLocation, ToExtensionObject, CreateExtensionsNamespace, ExtensionsNamespace_default;
26076+
var NoopDisposable, MakeMultiStub, Stub, MakePermissiveExports, NormalizeLocation, ToExtensionObject, IsExtensionKey, CreateExtensionsNamespace, ExtensionsNamespace_default;
2605226077
var init_ExtensionsNamespace = __esm({
2605326078
"Source/Services/Handler/VscodeAPI/ExtensionsNamespace.ts"() {
2605426079
"use strict";
@@ -26232,23 +26257,21 @@ var init_ExtensionsNamespace = __esm({
2623226257
activate: /* @__PURE__ */ __name(async () => Exports, "activate")
2623326258
};
2623426259
}, "ToExtensionObject");
26260+
IsExtensionKey = /* @__PURE__ */ __name((Key) => !Key.startsWith("__"), "IsExtensionKey");
2623526261
CreateExtensionsNamespace = /* @__PURE__ */ __name((Context21) => ({
2623626262
getExtension: /* @__PURE__ */ __name((Identifier) => {
26263+
if (!IsExtensionKey(Identifier)) return void 0;
2623726264
const Raw = Context21.ExtensionRegistry.get(Identifier);
2623826265
return Raw ? ToExtensionObject(Context21, Identifier, Raw) : void 0;
2623926266
}, "getExtension"),
2624026267
get all() {
26241-
return [...Context21.ExtensionRegistry.entries()].map(
26242-
([Id, Raw]) => ToExtensionObject(Context21, Id, Raw)
26243-
);
26268+
return [...Context21.ExtensionRegistry.entries()].filter(([Id]) => IsExtensionKey(Id)).map(([Id, Raw]) => ToExtensionObject(Context21, Id, Raw));
2624426269
},
2624526270
// Some extensions (html-language-features) iterate
2624626271
// `extensions.allAcrossExtensionHosts`; return the same array as `all`
2624726272
// so `for (...of...)` does not throw on `is not iterable`.
2624826273
get allAcrossExtensionHosts() {
26249-
return [...Context21.ExtensionRegistry.entries()].map(
26250-
([Id, Raw]) => ToExtensionObject(Context21, Id, Raw)
26251-
);
26274+
return [...Context21.ExtensionRegistry.entries()].filter(([Id]) => IsExtensionKey(Id)).map(([Id, Raw]) => ToExtensionObject(Context21, Id, Raw));
2625226275
},
2625326276
onDidChange: /* @__PURE__ */ __name((Listener) => {
2625426277
Context21.Emitter.on("deltaExtensions", Listener);

Target/Bootstrap/Implementation/CocoonMain.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Target/Effect/Bootstrap.js

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,6 +1727,17 @@ message RPCDataPayload {
17271727
Method: method,
17281728
Parameter: this.SerializeParameters(parameters)
17291729
};
1730+
if (method === "tree.register" && typeof process !== "undefined") {
1731+
try {
1732+
const Timestamp = process.hrtime.bigint().toString();
1733+
const Correlation = parameters?.[0]?.viewId ?? `req-${requestIdentifier}`;
1734+
process.stdout.write(
1735+
`[LandFix:Tree] wire-send method=${method} correlation=${Correlation} t=${Timestamp}
1736+
`
1737+
);
1738+
} catch {
1739+
}
1740+
}
17301741
const response = await this.SendRequestWithRetry(
17311742
request,
17321743
cancellationToken
@@ -17556,6 +17567,13 @@ function appendEscapedMarkdownCodeBlockFence(code, langId) {
1755617567
`${"`".repeat(desiredFenceLength)}`
1755717568
].join("\n");
1755817569
}
17570+
function appendEscapedMarkdownInlineCode(text) {
17571+
const longestBacktickRun = Math.max(0, ...(text.match(/`+/g) ?? []).map((m) => m.length));
17572+
const fence = "`".repeat(longestBacktickRun + 1);
17573+
const needsSpace = text.startsWith("`") || text.endsWith("`");
17574+
const content = needsSpace ? ` ${text} ` : text;
17575+
return `${fence}${content}${fence}`;
17576+
}
1755917577
function escapeDoubleQuotes(input) {
1756017578
return input.replace(/"/g, "&quot;");
1756117579
}
@@ -17692,6 +17710,8 @@ ${appendEscapedMarkdownCodeBlockFence(code, langId)}
1769217710
__name44(escapeMarkdownSyntaxTokens, "escapeMarkdownSyntaxTokens");
1769317711
__name(appendEscapedMarkdownCodeBlockFence, "appendEscapedMarkdownCodeBlockFence");
1769417712
__name44(appendEscapedMarkdownCodeBlockFence, "appendEscapedMarkdownCodeBlockFence");
17713+
__name(appendEscapedMarkdownInlineCode, "appendEscapedMarkdownInlineCode");
17714+
__name44(appendEscapedMarkdownInlineCode, "appendEscapedMarkdownInlineCode");
1769517715
__name(escapeDoubleQuotes, "escapeDoubleQuotes");
1769617716
__name44(escapeDoubleQuotes, "escapeDoubleQuotes");
1769717717
__name(removeMarkdownEscapes, "removeMarkdownEscapes");
@@ -25844,6 +25864,7 @@ var init_LanguagesNamespace = __esm({
2584425864
createDiagnosticCollection: /* @__PURE__ */ __name((Name) => {
2584525865
const Owner = Name ?? "default";
2584625866
const Store = /* @__PURE__ */ new Map();
25867+
let Disposed = false;
2584725868
return {
2584825869
name: Owner,
2584925870
set: /* @__PURE__ */ __name((UriOrEntries, Diagnostics) => {
@@ -25876,6 +25897,7 @@ var init_LanguagesNamespace = __esm({
2587625897
});
2587725898
}, "delete"),
2587825899
clear: /* @__PURE__ */ __name(() => {
25900+
if (Store.size === 0) return;
2587925901
Store.clear();
2588025902
Context21.MountainClient?.sendRequest("Diagnostic.Clear", [
2588125903
Owner
@@ -25891,6 +25913,9 @@ var init_LanguagesNamespace = __esm({
2589125913
get: /* @__PURE__ */ __name((Uri2) => Store.get(String(Uri2)) ?? [], "get"),
2589225914
has: /* @__PURE__ */ __name((Uri2) => Store.has(String(Uri2)), "has"),
2589325915
dispose: /* @__PURE__ */ __name(() => {
25916+
if (Disposed) return;
25917+
Disposed = true;
25918+
if (Store.size === 0) return;
2589425919
Store.clear();
2589525920
Context21.MountainClient?.sendRequest("Diagnostic.Clear", [
2589625921
Owner
@@ -26048,7 +26073,7 @@ var ExtensionsNamespace_exports = {};
2604826073
__export(ExtensionsNamespace_exports, {
2604926074
default: () => ExtensionsNamespace_default
2605026075
});
26051-
var NoopDisposable, MakeMultiStub, Stub, MakePermissiveExports, NormalizeLocation, ToExtensionObject, CreateExtensionsNamespace, ExtensionsNamespace_default;
26076+
var NoopDisposable, MakeMultiStub, Stub, MakePermissiveExports, NormalizeLocation, ToExtensionObject, IsExtensionKey, CreateExtensionsNamespace, ExtensionsNamespace_default;
2605226077
var init_ExtensionsNamespace = __esm({
2605326078
"Source/Services/Handler/VscodeAPI/ExtensionsNamespace.ts"() {
2605426079
"use strict";
@@ -26232,23 +26257,21 @@ var init_ExtensionsNamespace = __esm({
2623226257
activate: /* @__PURE__ */ __name(async () => Exports, "activate")
2623326258
};
2623426259
}, "ToExtensionObject");
26260+
IsExtensionKey = /* @__PURE__ */ __name((Key) => !Key.startsWith("__"), "IsExtensionKey");
2623526261
CreateExtensionsNamespace = /* @__PURE__ */ __name((Context21) => ({
2623626262
getExtension: /* @__PURE__ */ __name((Identifier) => {
26263+
if (!IsExtensionKey(Identifier)) return void 0;
2623726264
const Raw = Context21.ExtensionRegistry.get(Identifier);
2623826265
return Raw ? ToExtensionObject(Context21, Identifier, Raw) : void 0;
2623926266
}, "getExtension"),
2624026267
get all() {
26241-
return [...Context21.ExtensionRegistry.entries()].map(
26242-
([Id, Raw]) => ToExtensionObject(Context21, Id, Raw)
26243-
);
26268+
return [...Context21.ExtensionRegistry.entries()].filter(([Id]) => IsExtensionKey(Id)).map(([Id, Raw]) => ToExtensionObject(Context21, Id, Raw));
2624426269
},
2624526270
// Some extensions (html-language-features) iterate
2624626271
// `extensions.allAcrossExtensionHosts`; return the same array as `all`
2624726272
// so `for (...of...)` does not throw on `is not iterable`.
2624826273
get allAcrossExtensionHosts() {
26249-
return [...Context21.ExtensionRegistry.entries()].map(
26250-
([Id, Raw]) => ToExtensionObject(Context21, Id, Raw)
26251-
);
26274+
return [...Context21.ExtensionRegistry.entries()].filter(([Id]) => IsExtensionKey(Id)).map(([Id, Raw]) => ToExtensionObject(Context21, Id, Raw));
2625226275
},
2625326276
onDidChange: /* @__PURE__ */ __name((Listener) => {
2625426277
Context21.Emitter.on("deltaExtensions", Listener);

0 commit comments

Comments
 (0)