-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add std and inlay hints #8
Conversation
Could you avoid checking in fake_*.rs and instead add a build step to generate them? They are really big. |
async provideInlayHints(model, range, token) { | ||
let hints = await state.inlay_hints(); | ||
return hints.map((hint) => { | ||
if (hint.hint_type == 1) { |
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.
What about hint type 0?
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.
RA doesn't emit type 0 (type 0 is other in lsp/monaco):
match ih.kind {
InlayKind::TypeHint | InlayKind::ChainingHint => InlayHintType::Type,
InlayKind::ParameterHint => InlayHintType::Parameter,
},
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.
Could you remove that enum variant on the rust side? You can explicitly specify a discriminant to keep the numbers identical.
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.
I didn't get exactly what you want. InlayHintType
is not meaningless and is the rust equivalent of this enum: https://microsoft.github.io/monaco-editor/api/enums/monaco.languages.inlayhintkind.html
You want to send ih.kind
and move this match
to JS?
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.
If InlayHintType::Other
is not handled here I think it is best to remove this variant completely and only re-introduce it once it is being used. I think that will save some debugging when it becomes used.
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.
Aha, just the variant. I thought the whole enum should be removed.
There is a fair amount of commented out code. I think it should be removed before merging. |
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.
I didn't look at rust-pack, but the rest of the code LGTM. This is my first time looking at the code though and I don't have r+ permissions for this repo. r? @matklad ?
@@ -229,7 +247,7 @@ monaco.languages.onLanguage(modeId, async () => { | |||
} | |||
} | |||
|
|||
monaco.languages.setTokensProvider(modeId, { | |||
/*monaco.languages.setTokensProvider(modeId, { |
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.
Did you comment this out as you broke it, or for another reason?
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.
It is broken and for my experiment propose (adding to playground) a static highlighter was enough, so I removed it. But for "rust analyzer demo" we may want to bring it back even if it is broken and worse than static.
Break reproduce:
- go to https://ra-wasm.netlify.app/
- remove all the code
- press ctrl+Z.
bors r+ Fixed the permissions as well, so r+ should work now. |
Configuration problem: |
bors try |
What happened exactly? I can't see bors fail details. |
It didn't run because the |
Seems there is now a bors r=@matklad |
🔒 Permission denied Existing reviewers: click here to make HKalbasi a reviewer |
I think you need to add it to the workflow on your branch. bors r=matklad |
8: Add std and inlay hints r=matklad a=HKalbasi I actually done this as an experiment for adding [RA to playground](rust-lang/rust-playground#357) but I think this demo can also take advantage of this PR and by merging it, future people don't need to repeat my work. Fix #7 This satisfies me, but it is not great. Specially it is slower than RA on vscode, and I don't know why it should be that slow. Suggestions on this (and other problems) are welcome. Co-authored-by: hamidreza kalbasi <[email protected]> Co-authored-by: HKalbasi <[email protected]>
Yeah, I don't think it works. Can you add it there? |
Timed out. |
tryTimed out. |
"it" is the bors.toml? I rebased to master if it is. |
No, sorry. Add the |
bors r=matklad |
8: Add std and inlay hints r=matklad a=HKalbasi I actually done this as an experiment for adding [RA to playground](rust-lang/rust-playground#357) but I think this demo can also take advantage of this PR and by merging it, future people don't need to repeat my work. Fix #7 This satisfies me, but it is not great. Specially it is slower than RA on vscode, and I don't know why it should be that slow. Suggestions on this (and other problems) are welcome. Co-authored-by: hamidreza kalbasi <[email protected]>
Nope, sorry, it's still not working. |
Can you also add |
Canceled. |
bors try |
bors r=matklad |
tryBuild succeeded: |
Build succeeded: |
It's up on https://ra-wasm.netlify.app/, and it's awesome! |
I actually done this as an experiment for adding RA to playground but I think this demo can also take advantage of this PR and by merging it, future people don't need to repeat my work.
Fix #7
This satisfies me, but it is not great. Specially it is slower than RA on vscode, and I don't know why it should be that slow. Suggestions on this (and other problems) are welcome.