Skip to content

Commit

Permalink
Quick quickfix fixes (#130)
Browse files Browse the repository at this point in the history
* Update quickfix for Monaco >= 0.34.0

Quickfix was not doing anything in a production build, and failing
with "unsupported edit" in a debug build.

The problem was the `edit` attribute was renamed to `textEdit` in
Monaco 0.34.0.

* Fix quickfixes for invalid operators

We need to look up the replacement operator in this case rather than
just trying to upper case it (which does nothing for these operators).
  • Loading branch information
ojwb authored Jan 27, 2025
1 parent 55515f6 commit 68fc71a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/bbcbasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,20 @@ export function registerBbcBasicLanguage() {
provideCodeActions(model, range, context) {
const actions = context.markers.map(marker => {
const text = model.getValueInRange(marker);
const replacement = InvalidOperatorMap.has(text) ?
InvalidOperatorMap.get(text) :
text.toUpperCase();
return {
title: `Replace with ${text.toUpperCase()}`,
title: `Replace with ${replacement}`,
diagnostics: [marker],
kind: "quickfix",
edit: {
edits: [
{
resource: model.uri,
edit: {
textEdit: {
range: marker,
text: text.toUpperCase(),
text: replacement,
},
},
],
Expand Down

0 comments on commit 68fc71a

Please sign in to comment.