mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 09:38:38 +01:00
tslint
This commit is contained in:
@@ -254,4 +254,4 @@ export var schemaContributions: ISchemaContributions = {
|
||||
'default': {}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -40,7 +40,7 @@ export class JSONCompletion {
|
||||
let result: CompletionList = {
|
||||
items: [],
|
||||
isIncomplete: false
|
||||
}
|
||||
};
|
||||
|
||||
if (node && (node.type === 'string' || node.type === 'number' || node.type === 'boolean' || node.type === 'null')) {
|
||||
overwriteRange = Range.create(document.positionAt(node.start), document.positionAt(node.end));
|
||||
@@ -401,7 +401,7 @@ export class JSONCompletion {
|
||||
case 'string': return CompletionItemKind.Text;
|
||||
case 'object': return CompletionItemKind.Module;
|
||||
case 'property': return CompletionItemKind.Property;
|
||||
default: return CompletionItemKind.Value
|
||||
default: return CompletionItemKind.Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export class JSONDocumentSymbols {
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
let result = collectOutlineEntries([], root, void 0);
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ export interface IWorkspaceContextService {
|
||||
}
|
||||
|
||||
export interface IRequestService {
|
||||
(options: IXHROptions): Thenable<IXHRResponse>
|
||||
(options: IXHROptions): Thenable<IXHRResponse>;
|
||||
}
|
||||
|
||||
export class JSONSchemaService implements IJSONSchemaService {
|
||||
@@ -277,7 +277,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
var fpa = this.getOrAddFilePatternAssociation(pattern);
|
||||
associations.forEach(schemaId => {
|
||||
let id = this.normalizeId(schemaId);
|
||||
fpa.addSchema(id)
|
||||
fpa.addSchema(id);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -398,7 +398,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
resolveErrors.push(nls.localize('json.schema.invalidref', '$ref \'{0}\' in {1} can not be resolved.', linkPath, linkedSchema.id));
|
||||
}
|
||||
delete node.$ref;
|
||||
}
|
||||
};
|
||||
|
||||
let resolveExternalLink = (node: any, uri: string, linkPath: string): Thenable<any> => {
|
||||
return this.getOrAddSchemaHandle(uri).getUnresolvedSchema().then(unresolvedSchema => {
|
||||
@@ -409,7 +409,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
resolveLink(node, unresolvedSchema.schema, linkPath);
|
||||
return resolveRefs(node, unresolvedSchema.schema);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let resolveRefs = (node: any, parentSchema: any): Thenable<any> => {
|
||||
let toWalk = [node];
|
||||
@@ -443,7 +443,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
}
|
||||
}
|
||||
return Promise.all(openPromises);
|
||||
}
|
||||
};
|
||||
|
||||
return resolveRefs(schema, schema).then(_ => new ResolvedSchema(schema, resolveErrors));
|
||||
}
|
||||
@@ -486,7 +486,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
} else {
|
||||
let combinedSchema: IJSONSchema = {
|
||||
allOf: schemaIds.map(schemaId => ({ $ref: schemaId }))
|
||||
}
|
||||
};
|
||||
return this.addSchemaHandle(combinedSchemaId, combinedSchema);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
|
||||
documentRangeFormattingProvider: true,
|
||||
documentFormattingProvider: true
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
let workspaceContext = {
|
||||
@@ -79,20 +79,20 @@ let workspaceContext = {
|
||||
}
|
||||
return workspaceRelativePath;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let telemetry = {
|
||||
log: (key: string, data: any) => {
|
||||
connection.sendNotification(TelemetryNotification.type, { key, data });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let request = (options: IXHROptions): Thenable<IXHRResponse> => {
|
||||
if (Strings.startsWith(options.url, 'file://')) {
|
||||
let fsPath = URI.parse(options.url).fsPath;
|
||||
return new Promise<IXHRResponse>((c, e) => {
|
||||
fs.readFile(fsPath, 'UTF-8', (err, result) => {
|
||||
err ? e({ responseText: '', status: 404 }) : c({ responseText: result.toString(), status: 200 })
|
||||
err ? e({ responseText: '', status: 404 }) : c({ responseText: result.toString(), status: 200 });
|
||||
});
|
||||
});
|
||||
} else if (Strings.startsWith(options.url, 'vscode://')) {
|
||||
@@ -105,11 +105,11 @@ let request = (options: IXHROptions): Thenable<IXHRResponse> => {
|
||||
return {
|
||||
responseText: error.message,
|
||||
status: 404
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
return xhr(options);
|
||||
}
|
||||
};
|
||||
|
||||
let contributions = [
|
||||
new ProjectJSONContribution(request),
|
||||
@@ -134,17 +134,17 @@ documents.onDidChangeContent((change) => {
|
||||
// The settings interface describe the server relevant settings part
|
||||
interface Settings {
|
||||
json: {
|
||||
schemas: JSONSchemaSettings[]
|
||||
},
|
||||
schemas: JSONSchemaSettings[];
|
||||
};
|
||||
http : {
|
||||
proxy: string,
|
||||
proxyStrictSSL: boolean
|
||||
}
|
||||
proxy: string;
|
||||
proxyStrictSSL: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface JSONSchemaSettings {
|
||||
fileMatch?: string[],
|
||||
url?: string,
|
||||
fileMatch?: string[];
|
||||
url?: string;
|
||||
schema?: IJSONSchema;
|
||||
}
|
||||
|
||||
@@ -153,9 +153,9 @@ let schemaAssociations : ISchemaAssociations = void 0;
|
||||
|
||||
// The settings have changed. Is send on server activation as well.
|
||||
connection.onDidChangeConfiguration((change) => {
|
||||
var settings = <Settings>change.settings
|
||||
var settings = <Settings>change.settings;
|
||||
configureHttpRequests(settings.http && settings.http.proxy, settings.http && settings.http.proxyStrictSSL);
|
||||
|
||||
|
||||
jsonConfigurationSettings = settings.json && settings.json.schemas;
|
||||
updateConfiguration();
|
||||
});
|
||||
@@ -174,7 +174,7 @@ function updateConfiguration() {
|
||||
if (Array.isArray(association)) {
|
||||
association.forEach(url => {
|
||||
jsonSchemaService.registerExternalSchema(url, [pattern]);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user