MCPcopy Index your code
hub / github.com/VSCodeVim/Vim / addSearchStateToHistory

Method addSearchStateToHistory

src/cmd_line/commandLine.ts:365–379  ·  view source on GitHub ↗
(searchState: SearchState)

Source from the content-addressed store, hash-verified

363 }
364
365 public static async addSearchStateToHistory(searchState: SearchState) {
366 const prevSearchString = SearchCommandLine.previousSearchStates.at(-1)?.searchString;
367 // Store this search if different than previous
368 if (searchState.searchString !== prevSearchString) {
369 SearchCommandLine.previousSearchStates.push(searchState);
370 if (SearchCommandLine.history !== undefined) {
371 await SearchCommandLine.history.add(searchState.searchString);
372 }
373 }
374
375 // Make sure search history does not exceed configuration option
376 if (SearchCommandLine.previousSearchStates.length > configuration.history) {
377 SearchCommandLine.previousSearchStates.splice(0, 1);
378 }
379 }
380
381 /**
382 * Keeps the state of the current match, i.e. the match to which the cursor moves when the search is executed.

Callers 3

runMethod · 0.80
escapeMethod · 0.80

Calls 1

addMethod · 0.65

Tested by

no test coverage detected