Move DocumentLinkAdapter to /common/

This commit is contained in:
Alex Dima 2021-11-17 14:07:39 +01:00
parent 81023950c6
commit 89d05c5889
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
3 changed files with 44 additions and 28 deletions

View file

@ -22,7 +22,8 @@ import {
HoverAdapter,
DocumentHighlightAdapter,
RenameAdapter,
DocumentSymbolAdapter
DocumentSymbolAdapter,
DocumentLinkAdapter
} from '../common/lspLanguageFeatures';
export interface WorkerAccessor {
@ -43,30 +44,7 @@ export class HTMLRenameAdapter extends RenameAdapter<HTMLWorker> {}
export class HTMLDocumentSymbolAdapter extends DocumentSymbolAdapter<HTMLWorker> {}
export class DocumentLinkAdapter implements languages.LinkProvider {
constructor(private _worker: WorkerAccessor) {}
public provideLinks(
model: editor.IReadOnlyModel,
token: CancellationToken
): Promise<languages.ILinksList> {
const resource = model.uri;
return this._worker(resource)
.then((worker) => worker.findDocumentLinks(resource.toString()))
.then((items) => {
if (!items) {
return;
}
return {
links: items.map((item) => ({
range: toRange(item.range),
url: item.target
}))
};
});
}
}
export class HTMLDocumentLinkAdapter extends DocumentLinkAdapter<HTMLWorker> {}
function fromFormattingOptions(options: languages.FormattingOptions): lsTypes.FormattingOptions {
return {