[go: up one dir, main page]

Skip to content
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

Editor-agnostic auto-completion #18

Open
1 task
asg017 opened this issue May 2, 2021 · 3 comments
Open
1 task

Editor-agnostic auto-completion #18

asg017 opened this issue May 2, 2021 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@asg017
Copy link
Owner
asg017 commented May 2, 2021

Say you have:

element = html`<div>
<table>
...`

update = {
  element;
}

When updating the update cell and accessing element, I want to be able to use autocompletion (ie, <Tab>) to see all th enumerable fields of the element cell's value. In this case, it's an HTML element, so I should see a dropdown list of querySelector, querySelectorAll, getAttribute, etc.

But I use VS Code, some people like vim, others emacs. Autocompletion in each editor would be different, but the same underlying list of enumerable fields should be the same for all potential editor clients.

  • In the client (index.html websocket client), send messages back of resolved cells and their enumerable fields
    • Which client? there could be multiple ones, would need the editor to "choose" which client to use (maybe a keyboard shortcut on the index.html to mark "I wanna see this clients enumerable fields"?)
    • Would this work for nested values? like d = {a: {b: {c: 7}}} could have a autosuggested path d.a.b.c, may need to request valid fields from the editor client -> dev server -> index.html client on every cell (seems like fun)
    • Doesn't have to be cells either, window/global values like document or window.location should be supported as well
    • Seems like dealing with VS code will be the hardest part of this
@asg017 asg017 added this to the v1 milestone May 2, 2021
@asg017 asg017 added the enhancement New feature or request label May 2, 2021
@wizzard0
Copy link

Hm, this sounds like a job for the custom Language Server (with an additional complication that it would have to fetch actual values from the browser window) -- but at least it should cover multiple editors simultaneously? the list of tools with LSP support is steadily growing

@asg017
Copy link
Owner Author
asg017 commented May 15, 2021

@wizzard0 that sounds right! I haven't played much with vscode language servers, but from what I've used before it sounds do-able. There would need to be some sort of "connection" between a selected client and your code editor of choice, where the client shared data on what cells are active/what keys can be accessed on those objects. I dont know of any other VS Code language server that does this sort of dynamic auto-complete option (I'd imagine most just do static analysis of your code to figure it out).

"Editor-agnostic" would be key here, idk if any other editor that has a "language server" like vscode, mostly because Ive never looked into it. Im sure that vim has some crazy extensions that can do this, or Atom

@wizzard0
Copy link
wizzard0 commented May 15, 2021

idk if any other editor that has a "language server" like vscode

The list of tools on LSP website looks quite decent! dunno about the quality of integrations in all of them though. But Rust, Go etc etc. already provide LSPs so it seems like it's on its way to becoming a de-facto standard.

https://microsoft.github.io/language-server-protocol/implementors/tools/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants