-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Make JSDoc skipping public, plus more configurable #55739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
442b467
9119d2f
ba9dcab
8a4837c
66a0b09
46bbf0e
88bfd9e
2abd21b
b691830
9e2f8c1
3d60c92
fb22a3e
626ae3e
b6379cb
a273a91
a430b30
3ebdfb6
3673f9e
f393631
40b0cc4
12f5903
735c17c
b3e23a9
db14c33
517f289
9392280
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,6 +209,7 @@ import { | |
isStringLiteral, | ||
isStringLiteralLike, | ||
isTraceEnabled, | ||
JSDocParsingMode, | ||
JsonSourceFile, | ||
JsxEmit, | ||
length, | ||
|
@@ -393,16 +394,16 @@ export function computeCommonSourceDirectoryOfFilenames(fileNames: readonly stri | |
return getPathFromPathComponents(commonPathComponents); | ||
} | ||
|
||
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost { | ||
return createCompilerHostWorker(options, setParentNodes); | ||
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean, jsDocParsingMode?: JSDocParsingMode): CompilerHost { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think we should be threading in this to defaults. User of this API can always call thius method and override getSourceFile on their own .. there is nothing special here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that not providing this parameter will make it very inconvenient; this function and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally speaking I think this means that anywhere we can expect to find There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm.. Generally i like to go with conservative approach and avoid having to add additional surface area that we have to keep maintaining. This is ok i guess though , user can just create source file from file text easily to override but ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the option is fed in via the |
||
return createCompilerHostWorker(options, setParentNodes, /*system*/ undefined, jsDocParsingMode); | ||
} | ||
|
||
/** @internal */ | ||
export function createGetSourceFile( | ||
readFile: ProgramHost<any>["readFile"], | ||
getCompilerOptions: () => CompilerOptions, | ||
setParentNodes: boolean | undefined, | ||
skipNonSemanticJSDocParsing: boolean | undefined, | ||
jsDocParsingMode: JSDocParsingMode | undefined, | ||
): CompilerHost["getSourceFile"] { | ||
return (fileName, languageVersionOrOptions, onError) => { | ||
let text: string | undefined; | ||
|
@@ -418,7 +419,7 @@ export function createGetSourceFile( | |
} | ||
text = ""; | ||
} | ||
return text !== undefined ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes, /*scriptKind*/ undefined, skipNonSemanticJSDocParsing) : undefined; | ||
return text !== undefined ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes, /*scriptKind*/ undefined, jsDocParsingMode) : undefined; | ||
}; | ||
} | ||
|
||
|
@@ -459,8 +460,8 @@ export function createWriteFileMeasuringIO( | |
export function createCompilerHostWorker( | ||
options: CompilerOptions, | ||
setParentNodes?: boolean, | ||
skipNonSemanticJSDocParsing?: boolean, | ||
system: System = sys, | ||
jsDocParsingMode?: JSDocParsingMode, | ||
): CompilerHost { | ||
const existingDirectories = new Map<string, boolean>(); | ||
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames); | ||
|
@@ -482,7 +483,7 @@ export function createCompilerHostWorker( | |
const newLine = getNewLineCharacter(options); | ||
const realpath = system.realpath && ((path: string) => system.realpath!(path)); | ||
const compilerHost: CompilerHost = { | ||
getSourceFile: createGetSourceFile(fileName => compilerHost.readFile(fileName), () => options, setParentNodes, skipNonSemanticJSDocParsing), | ||
getSourceFile: createGetSourceFile(fileName => compilerHost.readFile(fileName), () => options, setParentNodes, jsDocParsingMode), | ||
getDefaultLibLocation, | ||
getDefaultLibFileName: options => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options)), | ||
writeFile: createWriteFileMeasuringIO( | ||
|
Uh oh!
There was an error while loading. Please reload this page.