Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Add initial custom-element standard snippet #106

Merged
merged 3 commits into from
Dec 8, 2017

Conversation

TimvdLippe
Copy link
Contributor

@TimvdLippe TimvdLippe commented Dec 8, 2017

This PR adds a simple standard snippet for a custom element definition. I didn't want to publish Polymer-specific definitions yet, as HTML imports are gone and test suites are probably going to change as well. Once the dust is settled, we can discuss extra snippets.

  • CHANGELOG.md has been updated

Fixes Polymer/atom-plugin#11
Supersedes #36


This change is Reviewable

@TimvdLippe TimvdLippe requested a review from rictic December 8, 2017 21:25
@@ -0,0 +1,19 @@
import {CompletionItemKind, InsertTextFormat} from 'vscode-languageserver';
Copy link
Contributor

Choose a reason for hiding this comment

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

License

@@ -0,0 +1,19 @@
import {CompletionItemKind, InsertTextFormat} from 'vscode-languageserver';

export default [
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend giving this a name, as these are specifically snippets for when the user is in a JS file.

@@ -437,7 +438,7 @@ suite('AutoCompleter', () => {
await client.openFile(indexFile, '<script>\n\n</script>\n' + indexContents);
const completions =
await client.getCompletions(indexFile, {line: 1, column: 0});
assert.deepEqual(completions, {isIncomplete: true, items: []});
assert.deepEqual(completions, {isIncomplete: false, items: standardSnippets});
Copy link
Contributor

Choose a reason for hiding this comment

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

Update the test name

@@ -114,6 +115,7 @@ export default class AutoCompleter extends Handler {
if (location.kind === 'attribute') {
return this.getAttributeCompletions(document, location);
}
return this.getStandardSnippetCompletions();
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, should explicitly check for the location being inside of a script section, as we might add other location kinds.

For bonus points it would be cool to do to JS what we did for CSS, and have an entire class of result for locResult.language === js but that might be more than you're interested in doing right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left a TODO, as I tried to make that work, but it required new AST traversal methods in ast-from-source-position, which seemed too much for this PR. Should be fixed someday though 😄

@TimvdLippe TimvdLippe merged commit 9e8f508 into Polymer:master Dec 8, 2017
@TimvdLippe TimvdLippe deleted the standard-snippets branch December 8, 2017 22:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants