UNPKG

equicord-companion

Version:

Equicord Companion is a vscode extension to test Equicord patches & webpack finds right from the comfort of your IDE

28 lines (23 loc) 940 B
import { CodeLens, CodeLensProvider, Position, ProviderResult, Range, TextDocument } from "vscode"; export class PartialModuleJumpCodeLensProvider implements CodeLensProvider { provideCodeLenses(document: TextDocument): ProviderResult<CodeLens[]> { const text = document.getText(); if (!(text.startsWith("// Webpack Module ") && text.substring(0, 100) .includes("//OPEN FULL MODULE: "))) return; const [, moduleId] = text.match(/^\/\/OPEN FULL MODULE: (\d{0,6})/m) ?? []; if (!moduleId) return; return [ { range: new Range(new Position(1, 0), new Position(1, 1)), command: { title: "Open Full Module", command: "equicord-companion.extract", arguments: [+moduleId], }, isResolved: true, }, ]; } }