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

Custom Attribute suggestions are not getting populated on auto complete #2564

Closed
Pranomvignesh opened this issue Jul 5, 2021 · 4 comments
Closed
Assignees

Comments

@Pranomvignesh
Copy link
Contributor

monaco-editor version: 0.25.2
Browser: Chrome
OS: Mac OS
Playground code that reproduces the issue:

const data = {
	"version": 1.1,
	"tags": [
	  {
		"name": "foo",
		"description": "The foo element",
		"attributes": [
		  { "name": "bar" },
		  {
			"name": "baz",
			"values": [
			  {
				"name": "baz-val-1" 
			  }
			]
		  }
		]
	  }
	],
	"globalAttributes": [
	  { "name": "fooAttr", "description": "Foo Attribute" },
	  { "name": "xattr", "description": "X attributes", "valueSet": "x" }
	],
	"valueSets": [
	  {
		"name": "x",
		"values": [
		  {
			"name": "xval",
			"description": "x value"
		  },
          {
			"name": "xy-val",
			"description": "x value"
		  },
          {
			"name": "xyx-val",
			"description": "x value"
		  },
          {
			"name": "z-val",
			"description": "x value"
		  }
		]
	  }
	]
  }


monaco.languages.html.htmlDefaults.setOptions({data: { useDefaultDataProvider: true, dataProviders: [ data ]}});

var template = `
<html>
    <head>
    </head>
    <body>
    </body>
</html>`;

monaco.editor.create(document.getElementById('container'), {
	value: template,
	language: 'html'
});

Sample Code taken from this issue : #2284
_Added new entries in valueset x and gave true to useDefaultDataProvider in options

Description

When I type xa , the autocomplete perfectly suggests the globalAttributes, but the suggestion for the value of the attribute is not shown when i continue typing ( I think it is because of the selection )
It will be better if the autocomplete suggestion for the attribute values are shown right after the attribute name is selected from the list

Current Behaviour

The suggestions are provided only after removing the quotes and retriggering the value suggestions by typing next to the = character

Expected Behaviour

The suggestions for values has to be provided immediately after the attribute name is autocompleted

Video Explaining the issue

SuggestionsNotDisplayedOnAutoComplete.mov
@aeschli
Copy link
Contributor

aeschli commented Jul 5, 2021

Thanks for reporting. Value sets with global attributes didn't work.
Fixed in the language service. Not sure how quick it will be in the monaco build.

@Pranomvignesh
Copy link
Contributor Author

Pranomvignesh commented Jul 5, 2021

@aeschli Thanks for the quick response . Value sets with global attributes didn't work. - Actually it is not about global attributes (or) Value sets, It didn't work when I tried the below snippet

const data = {
	"version": 1.1,
	"tags": [
	  {
		"name": "foo",
		"description": "The foo element",
		"attributes": [
		  { "name": "bar" },
		  {
			"name": "baz",
			"values": [
			  { "name": "baz-val-1" },
                          { "name": "baz-val-2" }
			]
		  }
		]
	  }
     ]
}

I hope this gets fixed in microsoft/vscode-html-languageservice@77e4483

aeschli added a commit to microsoft/monaco-html that referenced this issue Jul 5, 2021
@aeschli
Copy link
Contributor

aeschli commented Jul 6, 2021

For me there were no proposals at all as I tried with a tag other than foo. That's fixed now.

Your concern was that code completion automatically opens again (retriggers) after completing an attribute name?
I pushed a fix that too.

@Pranomvignesh
Copy link
Contributor Author

@aeschli Thanks for this feature microsoft/monaco-html@04c34d4. I will try this once it gets released in monaco-editor

@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants