Fix file cases
This commit is contained in:
Родитель
a76280d11c
Коммит
afefa50779
|
@ -1,4 +1,4 @@
|
|||
.DS_store
|
||||
.DS_Store
|
||||
.project
|
||||
*.log
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import * as ts_module from 'typescript/lib/tsserverlibrary';
|
||||
|
||||
export class ConfigFileWatcher {
|
||||
private readonly _watchedConfigs = new Set<string>();
|
||||
|
||||
public constructor(
|
||||
private readonly ts: typeof ts_module,
|
||||
private readonly onChange: (fileName: string) => void
|
||||
) { }
|
||||
|
||||
public ensureWatching(file: string) {
|
||||
if (!this.ts.sys.watchFile) {
|
||||
return;
|
||||
}
|
||||
if (this._watchedConfigs.has(file)) {
|
||||
return;
|
||||
}
|
||||
this._watchedConfigs.add(file);
|
||||
this.ts.sys.watchFile(file, (fileName: string, eventKind: ts.FileWatcherEventKind) => {
|
||||
if (eventKind === this.ts.FileWatcherEventKind.Changed) {
|
||||
this.onChange(fileName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import * as ts_module from 'typescript/lib/tsserverlibrary';
|
||||
|
||||
import { pluginId } from './config';
|
||||
|
||||
export class Logger {
|
||||
public static forPlugin(info: ts_module.server.PluginCreateInfo) {
|
||||
return new Logger(info.project.projectService.logger);
|
||||
}
|
||||
|
||||
private constructor(
|
||||
private readonly _logger: ts_module.server.Logger
|
||||
) { }
|
||||
|
||||
public info(message: string) {
|
||||
this._logger.info(`[${pluginId}] ${JSON.stringify(message)}`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import * as path from 'path';
|
||||
|
||||
/**
|
||||
* Settings for the plugin section in tsconfig.json
|
||||
*/
|
||||
export interface Settings {
|
||||
readonly alwaysShowRuleFailuresAsWarnings?: boolean;
|
||||
readonly ignoreDefinitionFiles?: boolean;
|
||||
readonly configFile?: string;
|
||||
readonly disableNoUnusedVariableRule?: boolean; // support to enable/disable the workaround for https://github.com/Microsoft/TypeScript/issues/15344
|
||||
readonly suppressWhileTypeErrorsPresent: boolean;
|
||||
}
|
||||
|
||||
export function loadSettingsFromTSConfig(config: any, projectRoot: string) {
|
||||
if (!config.configFile) {
|
||||
return config;
|
||||
}
|
||||
if (path.isAbsolute(config.configFile)) {
|
||||
return config;
|
||||
}
|
||||
config.configFile = path.join(projectRoot, config.configFile);
|
||||
return config;
|
||||
}
|
Загрузка…
Ссылка в новой задаче