From 30e065d90da37a85f2dece38061b7112991504be Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 16 Aug 2016 09:58:14 +0200 Subject: [PATCH] debt - remove unused code --- .../editor/common/modes/snippetsRegistry.ts | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/src/vs/editor/common/modes/snippetsRegistry.ts b/src/vs/editor/common/modes/snippetsRegistry.ts index f88ccf926eb..dee03a88496 100644 --- a/src/vs/editor/common/modes/snippetsRegistry.ts +++ b/src/vs/editor/common/modes/snippetsRegistry.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import * as strings from 'vs/base/common/strings'; import {IReadOnlyModel, IPosition} from 'vs/editor/common/editorCommon'; import {ISuggestion} from 'vs/editor/common/modes'; import {Registry} from 'vs/platform/platform'; @@ -20,8 +19,6 @@ export interface ISnippetsRegistry { */ registerSnippets(modeId: string, snippets: ISnippet[], owner?: string): void; - - /** * Visit all snippets */ @@ -63,43 +60,6 @@ class SnippetsRegistry { } } } - - public getSnippetCompletions(model: IReadOnlyModel, position: IPosition, result: ISuggestion[]): void { - let modeId = model.getModeId(); - if (!this._snippets[modeId]) { - return; - } - let word = model.getWordAtPosition(position); - let currentWord = word ? word.word.substring(0, position.column - word.startColumn).toLowerCase() : ''; - let currentFullWord = getNonWhitespacePrefix(model, position).toLowerCase(); - - this.visitSnippets(modeId, s => { - let overwriteBefore: number; - if (currentWord.length === 0 && currentFullWord.length === 0) { - // if there's no prefix, only show snippets at the beginning of the line, or after a whitespace - overwriteBefore = 0; - } else { - let label = s.prefix.toLowerCase(); - // force that the current word or full word matches with the snippet prefix - if (currentWord.length > 0 && strings.startsWith(label, currentWord)) { - overwriteBefore = currentWord.length; - } else if (currentFullWord.length > currentWord.length && strings.startsWith(label, currentFullWord)) { - overwriteBefore = currentFullWord.length; - } else { - return true; - } - } - result.push({ - type: 'snippet', - label: s.prefix, - documentation: s.description, - insertText: s.codeSnippet, - noAutoAccept: true, - overwriteBefore - }); - return true; - }); - } } export function getNonWhitespacePrefix(model: IReadOnlyModel, position: IPosition) : string {