Converted json extension to new vscode-nls npm module

This commit is contained in:
Dirk Baeumer
2016-03-03 16:54:36 +01:00
parent 189321eb12
commit 5354309a24
12 changed files with 167 additions and 144 deletions

View File

@@ -6,11 +6,13 @@
import {MarkedString, CompletionItemKind} from 'vscode-languageserver';
import Strings = require('../utils/strings');
import nls = require('../utils/nls');
import {IJSONWorkerContribution, ISuggestionsCollector} from '../jsonContributions';
import {IRequestService} from '../jsonSchemaService';
import {JSONLocation} from '../jsonLocation';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
export class BowerJSONContribution implements IJSONWorkerContribution {
private requestService : IRequestService;
@@ -41,7 +43,7 @@ export class BowerJSONContribution implements IJSONWorkerContribution {
'main': '{{pathToMain}}',
'dependencies': {}
};
result.add({ kind: CompletionItemKind.Class, label: nls.localize('json.bower.default', 'Default bower.json'), insertText: JSON.stringify(defaultValue, null, '\t'), documentation: '' });
result.add({ kind: CompletionItemKind.Class, label: localize('json.bower.default', 'Default bower.json'), insertText: JSON.stringify(defaultValue, null, '\t'), documentation: '' });
}
return null;
}
@@ -77,11 +79,11 @@ export class BowerJSONContribution implements IJSONWorkerContribution {
// ignore
}
} else {
result.error(nls.localize('json.bower.error.repoaccess', 'Request to the bower repository failed: {0}', success.responseText));
result.error(localize('json.bower.error.repoaccess', 'Request to the bower repository failed: {0}', success.responseText));
return 0;
}
}, (error) => {
result.error(nls.localize('json.bower.error.repoaccess', 'Request to the bower repository failed: {0}', error.responseText));
result.error(localize('json.bower.error.repoaccess', 'Request to the bower repository failed: {0}', error.responseText));
return 0;
});
} else {
@@ -110,7 +112,7 @@ export class BowerJSONContribution implements IJSONWorkerContribution {
if (this.isBowerFile(resource) && (location.matches(['dependencies', '*']) || location.matches(['devDependencies', '*']))) {
let pack = location.getSegments()[location.getSegments().length - 1];
let htmlContent : MarkedString[] = [];
htmlContent.push(nls.localize('json.bower.package.hover', '{0}', pack));
htmlContent.push(localize('json.bower.package.hover', '{0}', pack));
let queryUrl = 'https://bower.herokuapp.com/packages/' + encodeURIComponent(pack);