From 18c5888b9a3701ced2cf0d74b0e18c3a88b4c0ba Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Sun, 25 Feb 2018 18:13:10 +0900 Subject: [PATCH 1/2] Update typings in model.ts to allow nulls The searching functions in ITextModel allow one of its parameters to be null but the typings does not have this declared. If someone is compiling code in strict null checking mode then a false positive error will be flagged. Signed-off-by: Remy Suen --- src/vs/editor/common/model.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/common/model.ts b/src/vs/editor/common/model.ts index 31f7b8be66885..bf6ecbbee7c1b 100644 --- a/src/vs/editor/common/model.ts +++ b/src/vs/editor/common/model.ts @@ -666,7 +666,7 @@ export interface ITextModel { * @param limitResultCount Limit the number of results * @return The ranges where the matches are. It is empty if not matches have been found. */ - findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean, limitResultCount?: number): FindMatch[]; + findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[]; /** * Search the model. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. @@ -678,7 +678,7 @@ export interface ITextModel { * @param limitResultCount Limit the number of results * @return The ranges where the matches are. It is empty if no matches have been found. */ - findMatches(searchString: string, searchScope: IRange, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean, limitResultCount?: number): FindMatch[]; + findMatches(searchString: string, searchScope: IRange, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[]; /** * Search the model for the next match. Loops to the beginning of the model if needed. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. @@ -689,7 +689,7 @@ export interface ITextModel { * @param captureMatches The result will contain the captured groups. * @return The range where the next match is. It is null if no next match has been found. */ - findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): FindMatch; + findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch; /** * Search the model for the previous match. Loops to the end of the model if needed. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. @@ -700,7 +700,7 @@ export interface ITextModel { * @param captureMatches The result will contain the captured groups. * @return The range where the previous match is. It is null if no previous match has been found. */ - findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): FindMatch; + findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch; /** * Get the language associated with this model. From a99b8c1b6f04766812d16cb7151a6c00e30cbb45 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 1 Mar 2018 10:50:39 +0100 Subject: [PATCH 2/2] Add monaco.d.ts --- src/vs/monaco.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 9165cba0dc64d..6396279982ec5 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -1546,7 +1546,7 @@ declare module monaco.editor { * @param limitResultCount Limit the number of results * @return The ranges where the matches are. It is empty if not matches have been found. */ - findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean, limitResultCount?: number): FindMatch[]; + findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[]; /** * Search the model. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. @@ -1558,7 +1558,7 @@ declare module monaco.editor { * @param limitResultCount Limit the number of results * @return The ranges where the matches are. It is empty if no matches have been found. */ - findMatches(searchString: string, searchScope: IRange, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean, limitResultCount?: number): FindMatch[]; + findMatches(searchString: string, searchScope: IRange, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[]; /** * Search the model for the next match. Loops to the beginning of the model if needed. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. @@ -1569,7 +1569,7 @@ declare module monaco.editor { * @param captureMatches The result will contain the captured groups. * @return The range where the next match is. It is null if no next match has been found. */ - findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): FindMatch; + findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch; /** * Search the model for the previous match. Loops to the end of the model if needed. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. @@ -1580,7 +1580,7 @@ declare module monaco.editor { * @param captureMatches The result will contain the captured groups. * @return The range where the previous match is. It is null if no previous match has been found. */ - findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): FindMatch; + findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch; /** * Get the language associated with this model. */