阅读src\services代码后,似乎这是任何语言服务主机必须满足的接口:
//
// Public interface of the host of a language service instance.
//
export interface ILanguageServiceHost extends TypeScript.ILogger {
getCompilationSettings(): TypeScript.CompilationSettings;
getScriptCount(): number;
getScriptId(scriptIndex: number): string;
getScriptSourceText(scriptIndex: number, start: number, end: number): string;
getScriptSourceLength(scriptIndex: number): number;
getScriptIsResident(scriptIndex: number): bool;
getScriptVersion(scriptIndex: number): number;
getScriptEditRangeSinceVersion(scriptIndex: number, scriptVersion: number): TypeScript.ScriptEditRange;
}
我找不到任何文档或示例,虽然有些方法是不言自明的,但有些方法不是,特别是:
getScriptId()
getScriptIsResident()
getScriptVersion()
getScriptEditRangeSinceVersion()
语言服务 API 是否可以使用?有人可以简要解释上述方法的目的吗?