MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / onEditorLinkLine

Method onEditorLinkLine

static/panes/editor.ts:1753–1795  ·  view source on GitHub ↗
(editorId: number, lineNum: number, columnBegin: number, columnEnd: number, reveal: boolean)

Source from the content-addressed store, hash-verified

1751 }
1752
1753 onEditorLinkLine(editorId: number, lineNum: number, columnBegin: number, columnEnd: number, reveal: boolean): void {
1754 if (Number(editorId) === this.id) {
1755 if (reveal && lineNum) {
1756 this.pushRevealJump();
1757 this.hub.activateTabForContainer(this.container);
1758 this.editor.revealLineInCenter(lineNum);
1759 this.editor.focus();
1760 this.editor.setPosition({column: columnBegin >= 0 ? columnBegin : 0, lineNumber: lineNum});
1761 }
1762 this.decorations.linkedCode = [];
1763 if (lineNum && lineNum !== -1) {
1764 this.decorations.linkedCode.push({
1765 range: new monaco.Range(lineNum, 1, lineNum, 1),
1766 options: {
1767 isWholeLine: true,
1768 linesDecorationsClassName: 'linked-code-decoration-margin',
1769 className: 'linked-code-decoration-line',
1770 },
1771 });
1772 }
1773
1774 if (lineNum > 0 && columnBegin !== -1) {
1775 const lastTokenSpan = this.getTokenSpan(lineNum, columnEnd);
1776 this.decorations.linkedCode.push({
1777 range: new monaco.Range(lineNum, columnBegin, lineNum, lastTokenSpan.colEnd),
1778 options: {
1779 isWholeLine: false,
1780 inlineClassName: 'linked-code-decoration-column',
1781 },
1782 });
1783 }
1784 if (!this.settings.indefiniteLineHighlight) {
1785 if (this.fadeTimeoutId !== null) {
1786 clearTimeout(this.fadeTimeoutId);
1787 }
1788 this.fadeTimeoutId = setTimeout(() => {
1789 this.clearLinkedLine();
1790 this.fadeTimeoutId = null;
1791 }, 5000);
1792 }
1793 this.updateDecorations();
1794 }
1795 }
1796
1797 onEditorApplyQuickfix(editorId: number, range: monaco.IRange, text: string | null): void {
1798 if (editorId === this.id) {

Callers 1

onSettingsChangeMethod · 0.95

Calls 6

pushRevealJumpMethod · 0.95
getTokenSpanMethod · 0.95
clearLinkedLineMethod · 0.95
updateDecorationsMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected