mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge branch 'isInMultiLineComment' of https://github.com/aozgaa/TypeScript into isInMultiLineComment
This commit is contained in:
commit
6b4cd0bd03
10 files changed
+77
No files matched your search
@@ -1789,6 +1789,16 @@ namespace ts {
|
||||
return JsDoc.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);
|
||||
}
|
||||
|
||||
function getIsInMultiLineComment(_fileName: string, position: number): boolean {
|
||||
const sourceFile = syntaxTreeCache.getCurrentSourceFile(_fileName);
|
||||
const token = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
const _triviaWidth = token.getLeadingTriviaWidth(sourceFile); _triviaWidth;
|
||||
const _text = token.getText(sourceFile); _text;
|
||||
const _fullText = token.getFullText(sourceFile); _fullText;
|
||||
// TODO: distinguish multi-line and single line comments...
|
||||
return token.getFullStart() <= position && position < token.getStart(sourceFile, /*includeJsDocComment*/ false);
|
||||
}
|
||||
|
||||
function isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean {
|
||||
// '<' is currently not supported, figuring out if we're in a Generic Type vs. a comparison is too
|
||||
// expensive to do during typing scenarios
|
||||
@@ -2039,6 +2049,7 @@ namespace ts {
|
||||
getFormattingEditsForDocument,
|
||||
getFormattingEditsAfterKeystroke,
|
||||
getDocCommentTemplateAtPosition,
|
||||
getIsInMultiLineComment,
|
||||
isValidBraceCompletionAtPosition,
|
||||
getCodeFixesAtPosition,
|
||||
getEmitOutput,
|
||||
|
||||
@@ -247,6 +247,11 @@ namespace ts {
|
||||
*/
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* Returns JSON-encoded value of the type TextInsertion.
|
||||
*/
|
||||
getIsInMultiLineComment(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* Returns JSON-encoded boolean to indicate whether we should support brace location
|
||||
* at the current position.
|
||||
@@ -935,6 +940,13 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
public getIsInMultiLineComment(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
`getIsInMultiLineComment('${fileName}', ${position})`,
|
||||
() => this.languageService.getIsInMultiLineComment(fileName, position)
|
||||
);
|
||||
}
|
||||
|
||||
/// NAVIGATE TO
|
||||
|
||||
/** Return a list of symbols that are interesting to navigate to */
|
||||
|
||||
@@ -257,6 +257,7 @@ namespace ts {
|
||||
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
|
||||
|
||||
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
|
||||
getIsInMultiLineComment(fileName: string, position: number): boolean;
|
||||
|
||||
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
|
||||
|
||||
|
||||
Reference in new issue
Block a user