-
Notifications
You must be signed in to change notification settings - Fork 1
prototype: annotate-twoslash #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
SMotaal
wants to merge
11
commits into
outmark:main
Choose a base branch
from
SMotaal:smotaal/prototype/annotate-twoslash
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f4e6d08
initial prototype & test
SMotaal ca20434
add gitpkg-branch-consumer package
SMotaal b848713
fix: GroupCaptureRegExp types
SMotaal 74181a0
feat: add separate `@errs` query parameter
SMotaal e88bba4
fix: annotated markdown formatting
SMotaal 201c400
test: update assertions example
SMotaal 7ae9c00
fix: improve error narrowing for mismatched lines
SMotaal 8712a50
chore: add .gitignore
SMotaal 798421c
refactor: types
SMotaal 24e7528
test: add cases for assertion functions as function parameters
SMotaal f014797
feat: add independent `use-language-service` approach
SMotaal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,26 @@ | ||
| # @outmark/anno-type | ||
|
|
||
| A twoslash-inspired developer-oriented type-checking solution. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| As of now, this is still a very early prototype with little to no documentation and unstable if not faulty code. | ||
|
|
||
| You may get some idea on how the tool works by checking out the package scripts in the test folder: | ||
|
|
||
| - To run all the examples at once: | ||
|
|
||
| ```sh | ||
| # You can also just run this script in the test folder directly | ||
| yarn workspace anno-type-test annotate:examples | ||
| ``` | ||
|
|
||
| - To run a specific example with more verbose output: | ||
|
|
||
| ```sh | ||
| # Adding 1 to 3 exclamation marks anywhere dumps the current state. | ||
| # In this example the !! comes at the end and so it will dump the final state. | ||
| yarn workspace anno-type-test annotate:twoslash:examples \!\! | ||
| ``` | ||
|
|
||
| > **Note**: Interactive shells often require escaping each `\!` in a command line input. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/jsconfig", | ||
| "compilerOptions": { | ||
| "module": "ESNext", | ||
| "target": "ESNext", | ||
| "checkJs": true, | ||
| "moduleResolution": "NodeNext", | ||
| "keyofStringsOnly": true, | ||
| "strict": true, | ||
| "strictNullChecks": false, | ||
| "strictPropertyInitialization": false, | ||
| "noImplicitAny": false, | ||
| "noImplicitThis": false, | ||
| "noImplicitOverride": false, | ||
| "noImplicitReturns": false, | ||
| "suppressExcessPropertyErrors": true | ||
| }, | ||
| "exclude": [ | ||
| "node_modules", | ||
| "**/node_modules", | ||
| "**/[trash]/", | ||
| "test/**/output" | ||
| ] | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,9 @@ | |
| "packages": [ | ||
| "test", | ||
| "packages/*" | ||
| ], | ||
| "tests": [ | ||
| "test/packages/*" | ||
| ] | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additions:
To run
annotate-twoslashcommands with a specifiedworkspace:To run
annotate-twoslashcommands with package-root-relative paths:To run
annotate-twoslashcommands with working-directory-relative paths:A section on path resolution would outline the design choices and clarify how they are intended to mitigate ambiguities with some practical use cases.
Based on what was encountered so far the following seems like a good starting point which can be revised down the road with enough testing in feedback:
root-pathis used to simplify the resolution semantics with the following rules:--root-path.root-pathwill default to:require.resolveirrespective of package-scope.Those would then clarify what changes need to take place to iron out the obscurities in the implementation to make it stable enough to use.