MCPcopy
hub / github.com/philc/vimium / getUserSearchEngineForQuery

Method getUserSearchEngineForQuery

pages/vomnibar_page.js:386–397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

384 // Returns the UserSearchEngine for the given query. Returns null if the query does not begin with
385 // a keyword from one of the user's search engines.
386 getUserSearchEngineForQuery() {
387 // This logic is duplicated from SearchEngineCompleter.getEngineForQueryPrefix
388 const parts = this.input.value.trimStart().split(/\s+/);
389 // For a keyword "w", we match "w search terms" and "w ", but not "w" on its own.
390 const keyword = parts[0];
391 if (parts.length <= 1) return null;
392 // Don't match queries for built-in properties like "constructor". See #4396.
393 if (Object.hasOwn(userSearchEngines.keywordToEngine, keyword)) {
394 return userSearchEngines.keywordToEngine[keyword];
395 }
396 return null;
397 }
398
399 async update() {
400 await this.updateCompletions();

Callers 1

onInputMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected