Skip to content

Add warning diagnostic for V2 API use#35

Merged
microbit-matt-hillsdon merged 10 commits into
microbitfrom
version-warning-2
May 23, 2024
Merged

Add warning diagnostic for V2 API use#35
microbit-matt-hillsdon merged 10 commits into
microbitfrom
version-warning-2

Conversation

@microbit-matt-hillsdon

@microbit-matt-hillsdon microbit-matt-hillsdon commented May 22, 2024

Copy link
Copy Markdown

Alternative to #33

I've tried to pull the logic into checker.ts which feels more suitable for a high-level check.

Test data (I think the key parts of this are now in the automated tests):

# Imports go at the top
from microbit import *
from microbit import run_every
import log
import neopixel
from power import deep_sleep
import power

power.off()

deep_sleep(10)

log.add({
  'temperature': temperature(),
  'sound': microphone.sound_level(),
  'light': display.read_light_level()
})

pin_logo.get_mode()
pin_speaker
Sound.GIGGLE

audio.SoundEffect()

pin0.CAPACITIVE

np = neopixel.NeoPixel(pin12, 8)
np.fill((0, 0, 233))
np.write()

We plan to filter these out on the client based on connected device
version.
Comment thread packages/vscode-pyright/schemas/pyrightconfig.schema.json Outdated
Comment thread packages/pyright-internal/src/analyzer/checker.ts Outdated

@microbit-robert microbit-robert left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Works well. One comment to remove an outdated comment.

Comment thread packages/pyright-internal/src/analyzer/checker.ts Outdated
Comment thread packages/pyright-internal/src/tests/harness/fourslash/testState.ts Outdated
@microbit-matt-hillsdon microbit-matt-hillsdon merged commit 88fe2c9 into microbit May 23, 2024
@microbit-matt-hillsdon microbit-matt-hillsdon deleted the version-warning-2 branch May 23, 2024 13:11
microbit-matt-hillsdon pushed a commit to microbit-foundation/python-editor-v3 that referenced this pull request May 23, 2024
Updates Pyright to a version with the changes from microbit-foundation/pyright#35 and conditionally hides the new messages depending on the connected device.

A new setting can hide the messages. The setting can be flipped from a CodeMirror diagnostic action.

See https://microbit-global.monday.com/boards/1125389526/views/244984/pulses/1434825789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants