Use jsdoc/multiline-blocks instead of multiline-comment-style

Replace multiline-comment-style (starred-block), which also forces
multiline // comments into block comments, with jsdoc/multiline-blocks.
That rule only enforces starred JSDoc layout for /** blocks (no text on
the opening line) and leaves multiline // comments unchanged for
internal documentation.

Fix multiline JSDoc in Types.ts.

Fixes #5899

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-05-26 20:32:23 +00:00
co-authored by Daniel Imms
parent 4ec85e67ba
commit df3422fb0b
138 changed files with 1834 additions and 3028 deletions
+6 -10
View File
@@ -43,11 +43,9 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
throw new Error('Permission to access local fonts not granted.');
}
} catch (err: unknown) {
/*
* A `TypeError` indicates the 'local-fonts'
* permission is not yet implemented, so
* only `throw` if this is _not_ the problem.
*/
// A `TypeError` indicates the 'local-fonts'
// permission is not yet implemented, so
// only `throw` if this is _not_ the problem.
if (err instanceof Error && err.name !== 'TypeError') {
throw err;
}
@@ -91,11 +89,9 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
const fonts = await fontsPromise;
for (const family of parse(fontFamily)) {
/*
* If we reach one of the generic font families, the font resolution
* will end for the browser and we can't determine the specific font
* used. Throw.
*/
// If we reach one of the generic font families, the font resolution
// will end for the browser and we can't determine the specific font
// used. Throw.
if (genericFontFamilies.includes(family)) {
return undefined;
}
@@ -88,11 +88,9 @@ class FontImpl implements IFont {
glyphIds.push(this._font.charToGlyphIndex(char));
}
/*
* If there are no lookup groups, there's no point looking for
* replacements. This gives us a minor performance boost for fonts with
* no ligatures
*/
// If there are no lookup groups, there's no point looking for
// replacements. This gives us a minor performance boost for fonts with
// no ligatures
if (this._lookupTrees.length === 0) {
return {
inputGlyphs: glyphIds,
@@ -115,10 +113,8 @@ class FontImpl implements IFont {
}
public findLigatureRanges(text: string): [number, number][] {
/*
* Short circuit the process if there are no possible ligatures in the
* font
*/
// Short circuit the process if there are no possible ligatures in the
// font
if (this._lookupTrees.length === 0) {
return [];
}
@@ -174,11 +170,9 @@ class FontImpl implements IFont {
}
}
} else {
/*
* We don't need to do the lastGlyphIndex tracking here because
* reverse processing isn't allowed to replace more than one
* character at a time.
*/
// We don't need to do the lastGlyphIndex tracking here because
// reverse processing isn't allowed to replace more than one
// character at a time.
for (let i = nextLookup.last - 1; i >= nextLookup.first; i--) {
const result = walkTree(lookup.tree, sequence, i, i);
if (result) {
@@ -230,10 +224,8 @@ class FontImpl implements IFont {
for (let j = 0; j < lookups.length; j++) {
const lookupIndex = lookups[j];
if (lookupIndex >= start) {
/*
* Update the lookup information if it's the one we're
* storing or earlier than it.
*/
// Update the lookup information if it's the one we're
// storing or earlier than it.
if (result.index === null || lookupIndex <= result.index) {
result.index = lookupIndex;
@@ -32,11 +32,9 @@ export default function mergeTrees(trees: ILookupTree[]): ILookupTree {
function mergeSubtree(mainTree: ILookupTree, mergeTree: ILookupTree, mergedEntries: WeakMap<ILookupTreeEntry, Set<ILookupTreeEntry>>): void {
// Need to fix this recursively (and handle lookups)
for (const [glyphId, value] of Object.entries(mergeTree.individual)) {
/*
* The main tree is guaranteed to have no overlaps between the
* individual and range values, so if we match an invididual, there
* must not be a range
*/
// The main tree is guaranteed to have no overlaps between the
// individual and range values, so if we match an invididual, there
// must not be a range
if (mainTree.individual[glyphId]) {
mergeTreeEntry(mainTree.individual[glyphId], value, mergedEntries);
} else {
@@ -51,17 +49,13 @@ function mergeSubtree(mainTree: ILookupTree, mergeTree: ILookupTree, mergedEntri
matched = true;
/*
* If they overlap, we have to split the range and then
* merge the overlap
*/
// If they overlap, we have to split the range and then
// merge the overlap
mainTree.individual[glyphId] = value;
mergeTreeEntry(mainTree.individual[glyphId], cloneEntry(entry), mergedEntries);
/*
* When there's an overlap, we also have to fix up the range
* that we had already processed
*/
// When there's an overlap, we also have to fix up the range
// that we had already processed
mainTree.range.splice(index, 1);
for (const glyph of overlap.second) {
if (Array.isArray(glyph)) {
@@ -82,11 +76,9 @@ function mergeSubtree(mainTree: ILookupTree, mergeTree: ILookupTree, mergedEntri
}
for (const { range, entry } of mergeTree.range) {
/*
* Ranges are more complicated, because they can overlap with
* multiple things, individual and range alike. We start by
* eliminating ranges that are already present in another range
*/
// Ranges are more complicated, because they can overlap with
// multiple things, individual and range alike. We start by
// eliminating ranges that are already present in another range
let remainingRanges: (number | [number, number])[] = [range];
for (let index = 0; index < mainTree.range.length; index++) {
@@ -131,17 +123,13 @@ function mergeSubtree(mainTree: ILookupTree, mergeTree: ILookupTree, mergedEntri
continue;
}
/*
* If they overlap, we have to split the range and then
* merge the overlap
*/
// If they overlap, we have to split the range and then
// merge the overlap
mainTree.individual[remainingRange] = cloneEntry(entry);
mergeTreeEntry(mainTree.individual[remainingRange], cloneEntry(resultEntry), mergedEntries);
/*
* When there's an overlap, we also have to fix up the range
* that we had already processed
*/
// When there's an overlap, we also have to fix up the range
// that we had already processed
mainTree.range.splice(index, 1);
index--;
@@ -18,18 +18,14 @@ export default function mergeRange(ranges: [number, number][], newRangeStart: nu
return ranges;
}
if (newRangeEnd <= range[1]) {
/*
* Case 2: New range is either wholly contained within the
* search range or overlaps with the front of it
*/
// Case 2: New range is either wholly contained within the
// search range or overlaps with the front of it
range[0] = Math.min(newRangeStart, range[0]);
return ranges;
}
if (newRangeStart < range[1]) {
/*
* Case 3: New range either wholly contains the search range
* or overlaps with the end of it
*/
// Case 3: New range either wholly contains the search range
// or overlaps with the end of it
range[0] = Math.min(newRangeStart, range[0]);
inRange = true;
} else {
@@ -38,27 +34,21 @@ export default function mergeRange(ranges: [number, number][], newRangeStart: nu
}
} else {
if (newRangeEnd <= range[0]) {
/*
* Case 5: New range extends from previous range but doesn't
* reach the current one
*/
// Case 5: New range extends from previous range but doesn't
// reach the current one
ranges[i - 1][1] = newRangeEnd;
return ranges;
}
if (newRangeEnd <= range[1]) {
/*
* Case 6: New range extends from prvious range into the
* current range
*/
// Case 6: New range extends from prvious range into the
// current range
ranges[i - 1][1] = Math.max(newRangeEnd, range[1]);
ranges.splice(i, 1);
inRange = false;
return ranges;
}
/*
* Case 7: New range extends from previous range past the
* end of the current range
*/
// Case 7: New range extends from previous range past the
// end of the current range
ranges.splice(i, 1);
i--;
}
@@ -72,10 +72,8 @@ export default function buildTree(table: ChainingContextualSubstitutionTable.IFo
);
}
/*
* When we get to the end, all of the entries we've accumulated
* should have a lookup defined
*/
// When we get to the end, all of the entries we've accumulated
// should have a lookup defined
for (const { entry, substitutions } of currentEntries) {
entry.lookup = {
substitutions,
@@ -53,10 +53,8 @@ export default function buildTree(table: ChainingContextualSubstitutionTable.IFo
);
}
/*
* When we get to the end, all of the entries we've accumulated
* should have a lookup defined
*/
// When we get to the end, all of the entries we've accumulated
// should have a lookup defined
for (const { entry, substitutions } of currentEntries) {
entry.lookup = {
substitutions,
@@ -57,10 +57,8 @@ export function processLookaheadPosition(
range: []
};
/*
* All glyphs at this position share ONE entry - lookahead just needs to match,
* all paths lead to the same result
*/
// All glyphs at this position share ONE entry - lookahead just needs to match,
// all paths lead to the same result
const sharedEntry: ILookupTreeEntry = {};
for (const glyph of glyphs) {
@@ -102,10 +100,8 @@ export function processBacktrackPosition(
range: []
};
/*
* All glyphs at this position share ONE entry - backtrack just needs to match,
* all paths lead to the same result
*/
// All glyphs at this position share ONE entry - backtrack just needs to match,
// all paths lead to the same result
const sharedEntry: ILookupTreeEntry = {};
for (const glyph of glyphs) {
@@ -49,10 +49,8 @@ export function getIndividualSubstitutionGlyph(table: SubstitutionTable, glyphId
switch (table.substFormat) {
// https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#11-single-substitution-format-1
case 1:
/*
* TODO: determine if there's a rhyme or reason to the 16-bit
* wraparound and if it can ever be a different number
*/
// TODO: determine if there's a rhyme or reason to the 16-bit
// wraparound and if it can ever be a different number
return (glyphId + table.deltaGlyphId) % (2 ** 16);
// https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#12-single-substitution-format-2
case 2:
+8 -16
View File
@@ -15,10 +15,8 @@ const enum LoadingState {
FAILED
}
/*
* Caches 100K characters worth of ligatures. In practice this works out to
* about 650 KB worth of cache, when a moderate number of ligatures are present.
*/
// Caches 100K characters worth of ligatures. In practice this works out to
// about 650 KB worth of cache, when a moderate number of ligatures are present.
const CACHE_SIZE = 100000;
/**
@@ -48,10 +46,8 @@ export function enableLigatures(term: Terminal, fallbackLigatures: string[] = []
load(currentCallFontName, CACHE_SIZE)
.then(f => {
/*
* Another request may have come in while we were waiting, so make
* sure our font is still vaild.
*/
// Another request may have come in while we were waiting, so make
// sure our font is still vaild.
if (currentCallFontName === term.options.fontFamily) {
loadingState = LoadingState.LOADED;
font = f;
@@ -63,10 +59,8 @@ export function enableLigatures(term: Terminal, fallbackLigatures: string[] = []
}
})
.catch(e => {
/*
* Another request may have come in while we were waiting, so make
* sure our font is still vaild.
*/
// Another request may have come in while we were waiting, so make
// sure our font is still vaild.
if (currentCallFontName === term.options.fontFamily) {
loadingState = LoadingState.FAILED;
if (term.options.logLevel === 'debug') {
@@ -79,10 +73,8 @@ export function enableLigatures(term: Terminal, fallbackLigatures: string[] = []
}
if (font && loadingState === LoadingState.LOADED) {
/*
* We clone the entries to avoid the internal cache of the ligature finder
* getting messed up.
*/
// We clone the entries to avoid the internal cache of the ligature finder
// getting messed up.
return font.findLigatureRanges(text).map<[number, number]>(
range => [range[0], range[1]]
);
+6 -12
View File
@@ -27,10 +27,8 @@ export default function parse(family: string): string[] {
const families = [];
let currentFamily = '';
/*
* Work through the input character by character until there are none left.
* This lexing and parsing in one pass.
*/
// Work through the input character by character until there are none left.
// This lexing and parsing in one pass.
while (context.offset < context.input.length) {
const char = context.input[context.offset++];
switch (char) {
@@ -154,17 +152,13 @@ function parseUnicode(context: IParseContext): string {
while (context.offset < context.input.length) {
const char = context.input[context.offset++];
if (/\s/.test(char)) {
/*
* The first whitespace character after a unicode escape indicates the end
* of the escape and is swallowed.
*/
// The first whitespace character after a unicode escape indicates the end
// of the escape and is swallowed.
return unicodeToString(str);
}
if (str.length >= 6 || !/[\dA-Fa-f]/.test(char)) {
/*
* If the next character is not a valid hex digit or we have reached the
* maximum of 6 digits in the escape, terminate the escape.
*/
// If the next character is not a valid hex digit or we have reached the
// maximum of 6 digits in the escape, terminate the escape.
context.offset--;
return unicodeToString(str);
}