Skip to content

Commit de88ea0

Browse files
authored
chore: restore getFoldingBlock LSP API (#1429)
1 parent 190a4ce commit de88ea0

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

client/src/commands/run.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ async function getSelectedRegions(
4747
"sas/getFoldingBlock",
4848
{
4949
textDocument: { uri: window.activeTextEditor.document.uri.toString() },
50-
position: { line, col },
50+
line,
51+
col,
5152
},
5253
);
5354
if (block) {

server/src/server.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -280,22 +280,19 @@ export const runServer = (
280280
});
281281

282282
connection.onRequest("sas/getFoldingBlock", async (params) => {
283-
return await dispatch(params, {
284-
async default(languageServices) {
285-
const block = languageServices.sasLanguageService.getFoldingBlock(
286-
params.position.line,
287-
params.position.col,
288-
params.strict ?? true,
289-
params.ignoreCustomBlock,
290-
params.ignoreGlobalBlock,
291-
);
292-
if (!block) {
293-
return undefined;
294-
} else {
295-
return { ...block, outerBlock: undefined, innerBlocks: undefined };
296-
}
297-
},
298-
});
283+
const languageService = getLanguageService(params.textDocument.uri);
284+
const block = languageService.getFoldingBlock(
285+
params.line,
286+
params.col,
287+
params.strict ?? true,
288+
params.ignoreCustomBlock,
289+
params.ignoreGlobalBlock,
290+
);
291+
if (!block) {
292+
return undefined;
293+
} else {
294+
return { ...block, outerBlock: undefined, innerBlocks: undefined };
295+
}
299296
});
300297

301298
connection.onDocumentOnTypeFormatting(async (params) => {

0 commit comments

Comments
 (0)