Conversation
| * Copyright (c) 2019 The xterm.js authors. All rights reserved. | ||
| * @license MIT | ||
| * | ||
| * UnicodeVersionProvider for V11. |
| /** | ||
| * TODO: | ||
| * Need the following changes in xterm.js: | ||
| * - allow LinkProvider callback to contain multiple ranges (currently sloppy hacked into Linkifier2) |
There was a problem hiding this comment.
I'll be working on #2848 soon which will change the API to return all links for the current line.
There was a problem hiding this comment.
Well for the purpose of this addon all it needs are multiple buffer ranges for an URL to still recognize http://example.com as one link anchor text here:
╔═ file1 ════╗
║ ╔═ file2 ═══╗
║http://exa║Lorem ipsum║
║le.com ║ dolor sit ║
║ ║amet, conse║
╚══════════║ctetur adip║
╚═══════════╝
| * TODO: | ||
| * Need the following changes in xterm.js: | ||
| * - allow LinkProvider callback to contain multiple ranges (currently sloppy hacked into Linkifier2) | ||
| * - make extended attributes contributable by outer code |
There was a problem hiding this comment.
How about an ICellMarker API instead? Or tweaking the current one to optionally track a cell in a wrapped line?
There was a problem hiding this comment.
This needs some more design work, yes I think this can be turned into something like cell markers (that stick to a cell, thus would move with it).
| [...this._urlMap.keys()] | ||
| .filter(key => key < this._lowestId) | ||
| .forEach(key => this._urlMap.delete(key)); | ||
| [...this._idMap.entries()] | ||
| .filter(([unused, value]) => value < this._lowestId) | ||
| .forEach(([key, unused]) => this._idMap.delete(key)); |
There was a problem hiding this comment.
You probably know but [...arr].filter() is probably a little slow to put into a parser hook?
Would LRUMap be useful here? We could pull into the addon?
There was a problem hiding this comment.
Yeah, well it gets only executed once in a while (with default limits every 1000 urls). For some reason this declarative way was the only one I could find with proper type inference. Every loop attempt (which tend to be faster in general) was countered with type issues by TS lol.
LRUMap:
I think a linked list is not needed here, since the identifiers are just auto increasing integers (always to be cut from left side). Gonna rework that to a loop with early exit condition.
| activate: this._urlMap.get(urlId)!.schemeHandler.opener, | ||
| hover: (event: MouseEvent, text: string) => { | ||
| console.log('tooltip to show:', text); | ||
| } |
There was a problem hiding this comment.
activate, hover and leave need to be settable when creating the addon.
There was a problem hiding this comment.
As talked about earlier, this prolly will end up with the LinkProvider being exposed on addon API level for individual customization.
|
Playing around with this addon and a custom The |
|
That gif 🤯 |
|
@jerch link providers have been working great in vscode, 👍 for removing experimental from it |
|
This is far off, thus closing it. |

Early WIP.