Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.118.0 (unreleased)

- Provide F1 help at cursor in Positron (<https://github.com/quarto-dev/quarto/pull/599>)
- Expose new context keys for the language of a specific cell (<https://github.com/quarto-dev/quarto/pull/607>)

## 1.117.0 (Release on 2024-11-07)

Expand Down
8 changes: 6 additions & 2 deletions apps/vscode/src/vdoc/vdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
*/

import { Position, TextDocument, Uri, Range } from "vscode";
import { Position, TextDocument, Uri, Range, commands } from "vscode";
import { Token, isExecutableLanguageBlock, languageBlockAtPosition, languageNameFromBlock } from "quarto-core";

import { isQuartoDoc } from "../core/doc";
Expand Down Expand Up @@ -157,8 +157,12 @@ export async function virtualDocUri(
export function languageAtPosition(tokens: Token[], position: Position) {
const block = languageBlockAtPosition(tokens, position);
if (block) {
return languageFromBlock(block);
const language = languageFromBlock(block);
// expose cell language for use in keybindings, etc
commands.executeCommand('setContext', 'quarto.cellLangId', language?.ids[0]);
return language;
} else {
commands.executeCommand('setContext', 'quarto.cellLangId', undefined);
return undefined;
}
}
Expand Down