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

Method getLabelAtPosition

static/panes/compiler.ts:1088–1103  ·  view source on GitHub ↗
(position: monaco.Position)

Source from the content-addressed store, hash-verified

1086 // Returns a label name if it can be found in the given position, otherwise
1087 // returns null.
1088 getLabelAtPosition(position: monaco.Position): any | null {
1089 const asmLine = this.assembly[position.lineNumber - 1];
1090 // Outdated position.lineNumber can happen (Between compilations?) - Check for those and skip
1091
1092 if (asmLine) {
1093 const column = position.column;
1094 const labels = asmLine.labels || [];
1095
1096 for (let i = 0; i < labels.length; ++i) {
1097 if (column >= labels[i].range.startCol && column < labels[i].range.endCol) {
1098 return labels[i];
1099 }
1100 }
1101 }
1102 return null;
1103 }
1104
1105 // Jumps to a label definition related to a label which was found in the
1106 // given position and highlights the given range. If no label can be found in

Callers 2

jumpToLabelMethod · 0.95
registerEditorActionsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected