Break many functions out of services.ts and into their own modules.#10753
Conversation
|
Re: #10729 (comment) Every individual function in services.ts is now too small to really justify its own module (and the new PR now gives So, there would be more sophisticated refactoring involved with any changes made to simplify services now. Trying to keep this PR restricted to just moving code and adding parameters to functions taken out of closures. |
|
👍 @mhegazy may want to have a look. |
|
i would keep allocator.ts in services.ts, move meaning.ts to utilities.ts and move transpile/transpileModule/transpileOptions to a different file |
|
otherwise looks good. |
…anspile functions to a new file transpile.ts
|
This change breaks gulp-tsb, which used ts.preProcessFile as it was part of the public API. |
Redo of #10729.
Here are the updated changes:
allocators.ts: 634 lines
Exports:
getServicesObjectAllocator, a new function I made so that this module would need only 1 export.classifier.ts: 982 lines
Exports:
createClassifier,getSemanticClassifications,getEncodedSemanticClassifications,getSyntacticClassifications,getEncodedSyntacticClassificationsNew parameters:
checkForClassificationCancellation: cancellationTokengetSemanticClassifications: typeChecker, cancellationToken, sourceFile, classifiableNamesgetEncodedSemanticClassifications: typeChecker, cancellationToken, sourceFile, classifiableNamesgetSyntacticClassifications: cancellationToken, sourceFilegetEncodedSyntacticClassifications: cancellationToken, sourceFilecompletions.ts: 1648 lines
Exports:
getCompletionsAtPosition,getCompletionEntryDetailsNew parameters:
getCompletionsAtPosition: host, typeChecker, log, compilerOptions, sourceFilegetCompletionEntryDetails: typeChecker, log, compilerOptions, sourceFilegetCompletionData: typeChecker, log, sourceFilegetCompletionEntryDisplayNameForSymbol: typeCheckerdocumentHighlights.ts: 639 lines
Exports:
getDocumentHighlightsNew parameters:
getDocumentHighlights: typeChecker, cancellationToken, sourceFilefindAllReferences.ts: 1126 lines
Exports:
findReferencedSymbols,getReferencedSymbolsForNode,convertReferencesNew parameters:
findReferencedSymbols: typeChecker, cancellationToken, sourceFiles, sourceFilegetReferencedSymbolsForNode: typeChecker, cancellationTokengoToDefinition.ts: 257 lines
Exports:
getDefinitionAtPosition,getTypeDefinitionAtPositionNew parameters:
createDefinitionFromSignatureDeclaration: typeCheckergetDefinitionFromSymbol: typeCheckergetTypeDefinitionAtPosition: typeChecker, sourceFilecreateDefinitionFromSignatureDeclaration: typeCheckerjsDoc.ts: 546 lines
Exports:
getJsDocCommentsFromDeclarations,getAllJsDocCompletionEntries,getDocCommentTemplateAtPositionNew parameters:
getDocCommentTemplateAtPosition: sourceFile, newLinemeaning.ts: 161 lines
Exports:
SemanticMeaning,getMeaningFromDeclaration,getMeaningFromLocationpreProcess.ts: 361 lines
Exports:
preProcessFilerename.ts: 99 lines
Exports:
getRenameInfoNew parameters:
getRenameInfo: typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile
symbolDisplay.ts: 524 lines
Exports:
getSymbolKind,getSymbolModifiers,getSymbolDisplayPartsDocumentationAndSymbolKindNew parameters:
getSymbolDisplayPartsDocumentationAndSymbolKind: typeCheckergetSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar: typeCheckergetSymbolKind: typeCheckerutilities.ts
Everything above line 228 is new.
Breaking the now 1198 lines of utilities apart into logical categories will be a job for another PR.