33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { CompletionItemKind , CompletionItem , DocumentSelector , SnippetString , workspace , MarkdownString , Uri } from 'vscode' ;
6+ import { CompletionItemKind , CompletionItem , DocumentSelector , SnippetString , workspace , MarkdownString , Uri , l10n } from 'vscode' ;
77import { IJSONContribution , ISuggestionsCollector } from './jsonContributions' ;
88import { XHRRequest } from 'request-light' ;
99import { Location } from 'jsonc-parser' ;
1010
1111import * as cp from 'child_process' ;
12- import * as nls from 'vscode-nls' ;
1312import { dirname } from 'path' ;
14- const localize = nls . loadMessageBundle ( ) ;
1513
1614const LIMIT = 40 ;
1715
@@ -44,7 +42,7 @@ export class PackageJSONContribution implements IJSONContribution {
4442 'main' : '${5:pathToMain}' ,
4543 'dependencies' : { }
4644 } ;
47- const proposal = new CompletionItem ( localize ( 'json.package.default' , ' Default package.json' ) ) ;
45+ const proposal = new CompletionItem ( l10n . t ( " Default package.json" ) ) ;
4846 proposal . kind = CompletionItemKind . Module ;
4947 proposal . insertText = new SnippetString ( JSON . stringify ( defaultValue , null , '\t' ) ) ;
5048 result . add ( proposal ) ;
@@ -113,12 +111,12 @@ export class PackageJSONContribution implements IJSONContribution {
113111 }
114112 collector . setAsIncomplete ( ) ;
115113 } else {
116- collector . error ( localize ( 'json.npm.error.repoaccess' , ' Request to the NPM repository failed: {0}' , success . responseText ) ) ;
114+ collector . error ( l10n . t ( " Request to the NPM repository failed: {0}" , success . responseText ) ) ;
117115 return 0 ;
118116 }
119117 return undefined ;
120118 } , ( error ) => {
121- collector . error ( localize ( 'json.npm.error.repoaccess' , ' Request to the NPM repository failed: {0}' , error . responseText ) ) ;
119+ collector . error ( l10n . t ( " Request to the NPM repository failed: {0}" , error . responseText ) ) ;
122120 return 0 ;
123121 } ) ;
124122 } else {
@@ -172,7 +170,7 @@ export class PackageJSONContribution implements IJSONContribution {
172170 }
173171 collector . setAsIncomplete ( ) ;
174172 } else {
175- collector . error ( localize ( 'json.npm.error.repoaccess' , ' Request to the NPM repository failed: {0}' , success . responseText ) ) ;
173+ collector . error ( l10n . t ( " Request to the NPM repository failed: {0}" , success . responseText ) ) ;
176174 }
177175 return null ;
178176 } ) ;
@@ -195,21 +193,21 @@ export class PackageJSONContribution implements IJSONContribution {
195193 let proposal = new CompletionItem ( name ) ;
196194 proposal . kind = CompletionItemKind . Property ;
197195 proposal . insertText = name ;
198- proposal . documentation = localize ( 'json.npm.latestversion' , ' The currently latest version of the package' ) ;
196+ proposal . documentation = l10n . t ( " The currently latest version of the package" ) ;
199197 result . add ( proposal ) ;
200198
201199 name = JSON . stringify ( '^' + info . version ) ;
202200 proposal = new CompletionItem ( name ) ;
203201 proposal . kind = CompletionItemKind . Property ;
204202 proposal . insertText = name ;
205- proposal . documentation = localize ( 'json.npm.majorversion' , ' Matches the most recent major version (1.x.x)' ) ;
203+ proposal . documentation = l10n . t ( " Matches the most recent major version (1.x.x)" ) ;
206204 result . add ( proposal ) ;
207205
208206 name = JSON . stringify ( '~' + info . version ) ;
209207 proposal = new CompletionItem ( name ) ;
210208 proposal . kind = CompletionItemKind . Property ;
211209 proposal . insertText = name ;
212- proposal . documentation = localize ( 'json.npm.minorversion' , ' Matches the most recent minor version (1.2.x)' ) ;
210+ proposal . documentation = l10n . t ( " Matches the most recent minor version (1.2.x)" ) ;
213211 result . add ( proposal ) ;
214212 }
215213 }
@@ -224,7 +222,7 @@ export class PackageJSONContribution implements IJSONContribution {
224222 }
225223 if ( version ) {
226224 str . appendText ( '\n\n' ) ;
227- str . appendText ( localize ( 'json.npm.version.hover' , ' Latest version: {0}' , version ) ) ;
225+ str . appendText ( l10n . t ( " Latest version: {0}" , version ) ) ;
228226 }
229227 if ( homepage ) {
230228 str . appendText ( '\n\n' ) ;
0 commit comments