-
Notifications
You must be signed in to change notification settings - Fork 48
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
WIP: HTML support #43
Conversation
lua/typescript-tools/protocol/text_document/custom_diagnostic.lua
Outdated
Show resolved
Hide resolved
for character_index = 1, #line do | ||
local is_position_in_script = false | ||
|
||
for _, script_range in ipairs(scripts_ranges) do |
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.
My proposition is to map script ranges per lines to easly eliminate non js lines without additional iterations eg:
local scripts_ranges = {
-- line 1
[1] = {range1, ...rangeN},
-- line n
[n] = {rangeN, ...rangeM}
}
with this you can safetly and fast determine lines to "emptify" without iterating over all ranges for every line
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.
When line number isn't in scripts_ranges
just fast forward to emptify line. Otherwise try to monkeypatch line.
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've reversed the logic and now I'm emptying everything and then insert chars from script tags. I think it will be faster
I posted few ideas how to squeeze more performance and hopefully slimplify code |
c74dccd
to
51a61ab
Compare
FYI I've actually resigned from creating separate buffer for script content. Now I'm only rewriting |
Just wanted to try this out so I selected the feat-embedded-languages branch with Packer but even though
|
@marlun it was very old branch, but I've merged master into in and you can check if it helped. In the past there were some issues about finding typescript exetutable, but they were fixed |
Thanks, I'm no longer getting that error. I'm not sure if you want feedback on this, tell me otherwise. Now when I hit
My code looks like this and my cursor is on document when I hit <script>
const input = document.querySelector("input");
</script> |
This is VEEERY early stage. For now the diagnostics works very well. I've written one of the handler to show you the idea and see what you think.
Things to do:
#36
Screen.Recording.2023-06-02.at.22.26.46.mov