MCPcopy Create free account
hub / github.com/microsoft/codetour / updateMarkerTitleForStep

Function updateMarkerTitleForStep

src/utils.ts:179–201  ·  view source on GitHub ↗
(tour: CodeTour, stepNumber: number)

Source from the content-addressed store, hash-verified

177}
178
179async function updateMarkerTitleForStep(tour: CodeTour, stepNumber: number) {
180 if (!isMarkerStep(tour, stepNumber)) {
181 return;
182 }
183
184 const uri = await getStepFileUri(
185 tour.steps[stepNumber],
186 getWorkspaceUri(tour),
187 tour.ref
188 );
189
190 const document = await workspace.openTextDocument(uri);
191 const stepMarkerPrefix = getStepMarkerPrefix(tour);
192
193 const markerPattern = new RegExp(
194 `${stepMarkerPrefix}\\.${stepNumber + 1}\\s*[-:]\\s*(.*)`
195 );
196
197 const match = document.getText().match(markerPattern);
198 if (match) {
199 tour.steps[stepNumber].markerTitle = match[1];
200 }
201}
202
203async function updateMarkerTitlesForTour(tour: CodeTour) {
204 if (!isMarkerTour(tour)) {

Callers 1

Calls 5

isMarkerStepFunction · 0.85
getStepFileUriFunction · 0.85
getWorkspaceUriFunction · 0.85
getStepMarkerPrefixFunction · 0.85
getTextMethod · 0.80

Tested by

no test coverage detected