(scriptInfo: ts.server.ScriptInfo, textSpan: ts.TextSpan)
| 76 | * @param textSpan |
| 77 | */ |
| 78 | export function tsTextSpanToLspRange(scriptInfo: ts.server.ScriptInfo, textSpan: ts.TextSpan) { |
| 79 | const start = scriptInfo.positionToLineOffset(textSpan.start); |
| 80 | const end = scriptInfo.positionToLineOffset(textSpan.start + textSpan.length); |
| 81 | // ScriptInfo (TS) is 1-based, LSP is 0-based. |
| 82 | return lsp.Range.create(start.line - 1, start.offset - 1, end.line - 1, end.offset - 1); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Convert lsp.Position to the absolute offset in the file. LSP keeps track of |
no test coverage detected