mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-12 11:39:57 +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]);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function activate(context: ExtensionContext) {
|
||||
let serverOptions: ServerOptions = {
|
||||
run: { module: serverModule, transport: TransportKind.ipc },
|
||||
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
|
||||
}
|
||||
};
|
||||
|
||||
// Options to control the language client
|
||||
let clientOptions: LanguageClientOptions = {
|
||||
@@ -48,7 +48,7 @@ export function activate(context: ExtensionContext) {
|
||||
configurationSection: ['json.schemas', 'http.proxy', 'http.proxyStrictSSL'],
|
||||
fileEvents: workspace.createFileSystemWatcher('**/.json')
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Create the language client and start the client.
|
||||
let client = new LanguageClient('JSON Server', serverOptions, clientOptions);
|
||||
@@ -62,7 +62,7 @@ export function activate(context: ExtensionContext) {
|
||||
return workspace.openTextDocument(uri).then(doc => {
|
||||
return doc.getText();
|
||||
}, error => {
|
||||
return Promise.reject(error)
|
||||
return Promise.reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
|
||||
|
||||
var matches = (name:string) => {
|
||||
return prefix.length === 0 || name.length > prefix.length && name.substr(0, prefix.length) === prefix;
|
||||
}
|
||||
};
|
||||
|
||||
for (var name in phpGlobals.globalvariables) {
|
||||
if (phpGlobals.globalvariables.hasOwnProperty(name) && matches(name)) {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
// file generated from PHP53Schema.xml using php-exclude_generate_php_globals.js
|
||||
|
||||
export interface IEntry { description?: string; signature?: string }
|
||||
export interface IEntries { [name:string]:IEntry }
|
||||
export interface IEntry { description?: string; signature?: string; }
|
||||
export interface IEntries { [name:string]:IEntry; }
|
||||
|
||||
export var globalfunctions: IEntries = {
|
||||
password_get_info: {
|
||||
|
||||
@@ -68,14 +68,14 @@ namespace RunTrigger {
|
||||
export let strings = {
|
||||
onSave: 'onSave',
|
||||
onType: 'onType'
|
||||
}
|
||||
};
|
||||
export let from = function(value: string): RunTrigger {
|
||||
if (value === 'onType') {
|
||||
return RunTrigger.onType;
|
||||
} else {
|
||||
return RunTrigger.onSave;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default class PHPValidationProvider {
|
||||
@@ -175,10 +175,10 @@ export default class PHPValidationProvider {
|
||||
let diagnostic: vscode.Diagnostic = new vscode.Diagnostic(
|
||||
new vscode.Range(line, 0, line, Number.MAX_VALUE),
|
||||
message
|
||||
)
|
||||
);
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let options = vscode.workspace.rootPath ? { cwd: vscode.workspace.rootPath } : undefined;
|
||||
let args: string[];
|
||||
|
||||
@@ -95,7 +95,7 @@ export default class BufferSyncSupport {
|
||||
public reOpenDocuments(): void {
|
||||
Object.keys(this.syncedBuffers).forEach(key => {
|
||||
this.syncedBuffers[key].open();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
|
||||
@@ -13,14 +13,14 @@ export interface IConfiguration {
|
||||
|
||||
export var defaultConfiguration: IConfiguration = {
|
||||
useCodeSnippetsOnMethodSuggest: false
|
||||
}
|
||||
};
|
||||
|
||||
export function load(myPluginId: string): IConfiguration {
|
||||
let configuration = workspace.getConfiguration(myPluginId);
|
||||
|
||||
let useCodeSnippetsOnMethodSuggest = configuration.get('useCodeSnippetsOnMethodSuggest', defaultConfiguration.useCodeSnippetsOnMethodSuggest)
|
||||
let useCodeSnippetsOnMethodSuggest = configuration.get('useCodeSnippetsOnMethodSuggest', defaultConfiguration.useCodeSnippetsOnMethodSuggest);
|
||||
|
||||
return {
|
||||
useCodeSnippetsOnMethodSuggest
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -21,7 +21,7 @@ _kindMapping['var'] = SymbolKind.Variable;
|
||||
export default class TypeScriptWorkspaceSymbolProvider implements WorkspaceSymbolProvider {
|
||||
|
||||
private client: ITypescriptServiceClient;
|
||||
private modeId: string
|
||||
private modeId: string;
|
||||
|
||||
public constructor(client: ITypescriptServiceClient, modeId: string) {
|
||||
this.client = client;
|
||||
|
||||
@@ -101,7 +101,7 @@ export function fork(modulePath: string, args: string[], options: IForkOptions,
|
||||
}
|
||||
serverClosed = true;
|
||||
server.close();
|
||||
}
|
||||
};
|
||||
|
||||
// Create the process
|
||||
let bootstrapperPath = path.join(__dirname, 'electronForkStart');
|
||||
|
||||
@@ -23,7 +23,7 @@ var log = (function() {
|
||||
return;
|
||||
}
|
||||
fs.appendFileSync(LOG_LOCATION, str + '\n');
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
var stdInPipeName = process.env['STDIN_PIPE_NAME'];
|
||||
|
||||
@@ -189,7 +189,7 @@ export class Writer<T> {
|
||||
'\r\n\r\n',
|
||||
json,
|
||||
'\r\n'
|
||||
]
|
||||
];
|
||||
this.writable.write(buffer.join(''), 'utf8');
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import {marked, MarkedOptions} from 'vs/base/common/marked/marked';
|
||||
|
||||
|
||||
function link(href, title, text): string {
|
||||
return `<a href="#" data-href="${href}" title="${title || text}">${text}</a>`
|
||||
return `<a href="#" data-href="${href}" title="${title || text}">${text}</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,4 +38,4 @@ export const value = {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -93,7 +93,6 @@ export abstract class Parser {
|
||||
destination[key] = sourceValue;
|
||||
} else {
|
||||
if (overwrite) {
|
||||
let source
|
||||
if (Types.isObject(destValue) && Types.isObject(sourceValue)) {
|
||||
this.merge(destValue, sourceValue, overwrite);
|
||||
} else {
|
||||
|
||||
@@ -101,7 +101,7 @@ function isUpper(code: number): boolean {
|
||||
*/
|
||||
export function matches(target: string, queryLower: string): boolean {
|
||||
if (!target || !queryLower) {
|
||||
return false // return early if target or query are undefined
|
||||
return false; // return early if target or query are undefined
|
||||
}
|
||||
|
||||
const queryLen = queryLower.length;
|
||||
|
||||
@@ -21,7 +21,7 @@ export class JSONIntellisense {
|
||||
|
||||
private schemaService: SchemaService.IJSONSchemaService;
|
||||
private requestService: IRequestService;
|
||||
private contributions: JsonWorker.IJSONWorkerContribution[]
|
||||
private contributions: JsonWorker.IJSONWorkerContribution[];
|
||||
|
||||
constructor(schemaService: SchemaService.IJSONSchemaService, requestService: IRequestService, contributions: JsonWorker.IJSONWorkerContribution[]) {
|
||||
this.schemaService = schemaService;
|
||||
|
||||
@@ -282,7 +282,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
var fpa = this.getOrAddFilePatternAssociation(pattern);
|
||||
associations.forEach(schemaId => {
|
||||
var id = this.normalizeId(schemaId);
|
||||
fpa.addSchema(id)
|
||||
fpa.addSchema(id);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -399,7 +399,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;
|
||||
}
|
||||
};
|
||||
|
||||
var resolveExternalLink = (node: any, uri: string, linkPath: string): WinJS.Promise => {
|
||||
return this.getOrAddSchemaHandle(uri).getUnresolvedSchema().then(unresolvedSchema => {
|
||||
@@ -410,7 +410,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
resolveLink(node, unresolvedSchema.schema, linkPath);
|
||||
return resolveRefs(node, unresolvedSchema.schema);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var resolveRefs = (node:any, parentSchema: any) : WinJS.Promise => {
|
||||
var toWalk = [ node ];
|
||||
@@ -444,7 +444,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
}
|
||||
}
|
||||
return WinJS.Promise.join(openPromises);
|
||||
}
|
||||
};
|
||||
|
||||
return resolveRefs(schema, schema).then(_ => new ResolvedSchema(schema, resolveErrors));
|
||||
}
|
||||
@@ -485,7 +485,7 @@ export class JSONSchemaService implements IJSONSchemaService {
|
||||
} else {
|
||||
var combinedSchema: IJSONSchema = {
|
||||
allOf: schemaIds.map(schemaId => ({ $ref: schemaId }))
|
||||
}
|
||||
};
|
||||
return this.addSchemaHandle(combinedSchemaId, combinedSchema);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace LineMap {
|
||||
startColumn: startPosition.column,
|
||||
endLineNumber: endPosition.lineNumber,
|
||||
endColumn: endPosition.column,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user