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

autocomplete and import vals #8

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jrmann100
Copy link

@jrmann100 jrmann100 commented Sep 1, 2024

For parity with the val.town editor, adds:

  • A completions hook which calls the autocomplete API.
  • A command which imports a val from a completion.
  • Customization options for versioning behavior when (re)importing vals.

Please test:

  • Manually triggering completions with ctrl + space
  • Automatically triggering completions on @[<handle>[/<val>]]
  • Importing default exports and named exports
  • Importing a val which has not been imported before
  • Importing a val which has been imported before (with a different version? with other exports?)
  • Other combinations of the above
  • Settings for auto import

"valtown.autoImport.staticVersion": {
"type": "boolean",
"markdownDescription": "Use a static version when automatically importing vals, like this.\n\n| Option | Example |\n|--------|---------|\n| `false` | `import \"https://esm.town/v/steveKrouse/helloWorld\"` |\n| `true` | `import \"https://esm.town/v/steveKrouse/helloWorld?v=14\"` |\n\nThis is useful for ensuring that your code doesn't break when the val is updated.",
"default": false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting to think that this should be true by default for parity with the editor.

@pomdtr
Copy link
Collaborator

pomdtr commented Sep 1, 2024

Hey, thanks a lot for your contribution, it looks incredible! I took a quick look at the code (looks good), and I'll test the extension on my instance of vscode tomorrow.

I wonder if all these customization options are necessary. I would vote for just following whatever behaviour the website editor has, so the end user doesn't get confused.

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

Successfully merging this pull request may close these issues.

2 participants