diff --git a/src/services/keywordCompletions.ts b/src/services/keywordCompletions.ts
deleted file mode 100644
index 5e6b667b2d9..00000000000
--- a/src/services/keywordCompletions.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
-// See LICENSE.txt in the project root for complete license information.
-
-///
-
-module TypeScript.Services {
- export class KeywordCompletions {
- private static keywords = [
- "break",
- "case",
- "catch",
- "class",
- "constructor",
- "continue",
- "debugger",
- "declare",
- "default",
- "delete",
- "do",
- "else",
- "enum",
- "export",
- "extends",
- "false",
- "finally",
- "for",
- "function",
- "get",
- "if",
- "implements",
- "import",
- "in",
- "instanceof",
- "interface",
- "module",
- "new",
- "null",
- "private",
- "public",
- "require",
- "return",
- "set",
- "static",
- "super",
- "switch",
- "this",
- "throw",
- "true",
- "try",
- "typeof",
- "var",
- "while",
- "with",
- ];
-
- private static keywordCompletions: ts.CompletionEntry[] = null;
-
- public static getKeywordCompltions(): ts.CompletionEntry[]{
- if (KeywordCompletions.keywordCompletions === null) {
- var completions: ts.CompletionEntry[] = [];
- for (var i = 0, n = KeywordCompletions.keywords.length; i < n; i++) {
- var keyword = KeywordCompletions.keywords[i];
- completions.push({
- name: keyword,
- kind: ts.ScriptElementKind.keyword,
- kindModifiers: ts.ScriptElementKindModifier.none
- });
- }
-
- KeywordCompletions.keywordCompletions = completions;
- }
-
- return KeywordCompletions.keywordCompletions;
- }
- }
-}
\ No newline at end of file
diff --git a/src/services/services.ts b/src/services/services.ts
index 488cd4a7282..99e2b60b23f 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -12,7 +12,6 @@
///
///
///
-///
///
///
@@ -1194,6 +1193,7 @@ module ts {
var documentRegistry = documentRegistry;
var cancellationToken = new CancellationToken(host.getCancellationToken());
var activeCompletionSession: CompletionSession;
+ var keywordCompletions = getKeywordCompletionEntries();
// Check if the localized messages json is set, otherwise query the host for it
if (!TypeScript.LocalizedDiagnosticMessages) {
@@ -1349,6 +1349,37 @@ module ts {
};
}
+ function getKeywordCompletionEntries(): CompletionEntry[] {
+ var keywords = [
+ "break",
+ "case", "catch", "class", "constructor", "continue",
+ "debugger", "declare", "default", "delete", "do",
+ "else", "enum", "export", "extends",
+ "false", "finally", "for", "function",
+ "get",
+ "if","implements", "import", "in", "instanceof", "interface",
+ "module",
+ "new", "null",
+ "private", "public",
+ "require","return",
+ "set", "static", "super", "switch",
+ "this", "throw", "true", "try", "typeof",
+ "var",
+ "while","with",
+ ];
+
+ var result = [];
+ forEach(keywords, (keyword) => {
+ result.push({
+ name: keyword,
+ kind: ScriptElementKind.keyword,
+ kindModifiers: ScriptElementKindModifier.none
+ });
+ });
+
+ return result;
+ }
+
function getCompletionsAtPosition(filename: string, position: number, isMemberCompletion: boolean) {
function getCompletionEntriesFromSymbols(symbols: ts.Symbol[], session: CompletionSession): void {
ts.forEach(symbols, (symbol) => {
@@ -1485,7 +1516,7 @@ module ts {
// Add keywords if this is not a member completion list
if (!isMemberCompletion) {
- Array.prototype.push.apply(activeCompletionSession.entries, TypeScript.Services.KeywordCompletions.getKeywordCompltions());
+ Array.prototype.push.apply(activeCompletionSession.entries, keywordCompletions);
}
return {