Repository navigation
Keep Location-based plugin code working with Locatables - #1928
Merged
Merged
Conversation
Token declares the deprecated location again, so plugins that read token.location or pass tokens where a { location } is expected still compile. Tokens and nodes can be given a location by assigning it, and the creators accept a Location as well as a Locatable.
A Location outside a parsed source gets a position in a placeholder source for its uri, which util.getLocation() turns back into the same location.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bslint v1 failed to compile against #1845 (36 errors), because
Tokenno longer declaredlocation. This restores compile- and runtime compatibility for plugins written against theLocationAPI.Tokendeclares the deprecatedlocation: Locationagain, as in v1.token.locationornode.locationnow moves the item instead of throwing (newutil.assignLocation()). This reverses Add deprecated location/range getters to tokens and nodes #1876's read-only choice.createToken,createIdentifierand the othercreate*functions accept aLocationas well as aLocatable(util.toLocatable()).Locationoutside a known source gets a position in a placeholder source per uri, soutil.getLocation()round-trips it and items from the same uri still combine. They don't combine with the file's parsed AST.super()call injected into constructors used hand-built tokens without the getters; it now uses the creators.Verified:
npm testpasses. bslint v1 against this branch:tscandnpm run buildare clean, its 136 tests pass, and lint plus--fixon playlet-lib, playlet-app and maestro-roku-sample give identical diagnostics and fixed files to v1.🤖 Generated with Claude Code