mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 20:52:56 +01:00
Move DocumentLinkAdapter to /common/
This commit is contained in:
parent
81023950c6
commit
89d05c5889
3 changed files with 44 additions and 28 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue