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