(projectFileName: string)
| 157 | } |
| 158 | |
| 159 | openFile(projectFileName: string): OpenBuffer { |
| 160 | if (!this.buffers.has(projectFileName)) { |
| 161 | const fileName = absoluteFrom(`/${this.name}/${projectFileName}`); |
| 162 | let scriptInfo = this.tsProject.getScriptInfo(fileName); |
| 163 | this.projectService.openClientFile( |
| 164 | // By attempting to open the file, the compiler is going to try to parse it as |
| 165 | // TS which will throw an error. We pass in JSX which is more permissive. |
| 166 | fileName, |
| 167 | undefined, |
| 168 | fileName.endsWith('.html') ? ts.ScriptKind.JSX : ts.ScriptKind.TS, |
| 169 | ); |
| 170 | |
| 171 | scriptInfo = this.tsProject.getScriptInfo(fileName); |
| 172 | if (scriptInfo === undefined) { |
| 173 | throw new Error( |
| 174 | `Unable to open ScriptInfo for ${projectFileName} in project ${this.tsConfigPath}`, |
| 175 | ); |
| 176 | } |
| 177 | this.buffers.set( |
| 178 | projectFileName, |
| 179 | new OpenBuffer(this.ngLS, this.tsProject, projectFileName, scriptInfo), |
| 180 | ); |
| 181 | } |
| 182 | |
| 183 | return this.buffers.get(projectFileName)!; |
| 184 | } |
| 185 | |
| 186 | getSourceFile(projectFileName: string): ts.SourceFile | undefined { |
| 187 | const fileName = absoluteFrom(`/${this.name}/${projectFileName}`); |
no test coverage detected