Skip to content

Commit 448eaa2

Browse files
committed
[json] descriptions for package completions
1 parent 9c7a650 commit 448eaa2

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

extensions/javascript/src/features/packageJSONContribution.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class PackageJSONContribution implements IJSONContribution {
6767
return this.collectScopedPackages(currentWord, addValue, isLast, collector);
6868
}
6969

70-
queryUrl = 'https://skimdb.npmjs.com/registry/_design/app/_view/browseAll?group_level=1&limit=' + LIMIT + '&start_key=%5B%22' + encodeURIComponent(currentWord) + '%22%5D&end_key=%5B%22' + encodeURIComponent(currentWord + 'z') + '%22,%7B%7D%5D';
70+
queryUrl = 'https://skimdb.npmjs.com/registry/_design/app/_view/browseAll?group_level=2&limit=' + LIMIT + '&start_key=%5B%22' + encodeURIComponent(currentWord) + '%22%5D&end_key=%5B%22' + encodeURIComponent(currentWord + 'z') + '%22,%7B%7D%5D';
7171

7272
return this.xhr({
7373
url: queryUrl,
@@ -93,7 +93,7 @@ export class PackageJSONContribution implements IJSONContribution {
9393
proposal.kind = CompletionItemKind.Property;
9494
proposal.insertText = insertText;
9595
proposal.filterText = JSON.stringify(name);
96-
proposal.documentation = '';
96+
proposal.documentation = keys[1];
9797
collector.add(proposal);
9898
}
9999
}
@@ -214,7 +214,8 @@ export class PackageJSONContribution implements IJSONContribution {
214214
if (typeof currentKey === 'string') {
215215
const queryUrl = 'http://registry.npmjs.org/' + encodeURIComponent(currentKey).replace('%40', '@');
216216
return this.xhr({
217-
url: queryUrl
217+
url: queryUrl,
218+
agent: USER_AGENT
218219
}).then((success) => {
219220
try {
220221
const obj = JSON.parse(success.responseText);
@@ -273,7 +274,8 @@ export class PackageJSONContribution implements IJSONContribution {
273274

274275
const queryUrl = 'http://registry.npmjs.org/' + encodeURIComponent(pack).replace('%40', '@');
275276
return this.xhr({
276-
url: queryUrl
277+
url: queryUrl,
278+
agent: USER_AGENT
277279
}).then((success) => {
278280
try {
279281
const obj = JSON.parse(success.responseText);

0 commit comments

Comments
 (0)