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

make dataproviders or languageservices accessible for customdata #2284

Closed
mknj opened this issue Dec 23, 2020 · 6 comments
Closed

make dataproviders or languageservices accessible for customdata #2284

mknj opened this issue Dec 23, 2020 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities html
Milestone

Comments

@mknj
Copy link

mknj commented Dec 23, 2020

background

custom data allows to extend language services in a clever way.

use case

My use case is to generate custom data for web components via wca and provide an live documentation.

vscode reference

In vscode i can instruct the HTML and CSS langugage services to use custom data via simple configuation.

possible implementations

Monaco uses the same language service but does not expose the needed functionality.
(i.e. htmlLanguageService.setDataProviders( newHTMLDataProvider("hello",myCustomData)))

Please either add custom data to the configuration options or provide a way to access the language service from outside.

demo (stolen from vscode)

image

@alexdima alexdima added the feature-request Request for new features or functionality label Dec 29, 2020
@alexdima
Copy link
Member

cc @aeschli

@alexdima alexdima added the html label Dec 29, 2020
@aeschli aeschli added the help wanted Issues identified as good community contribution opportunities label Jan 4, 2021
@aeschli
Copy link
Contributor

aeschli commented Jan 4, 2021

Help is wanted here. If you have a interest, I'm happy to accept a PR. I guess it would be done as a new html option: https://github.com/microsoft/monaco-html/blob/f1754a3b261f92ca906a4a3a7fb81474254e24b3/monaco.d.ts#L26

aeschli added a commit to microsoft/monaco-html that referenced this issue Jun 10, 2021
aeschli added a commit to microsoft/monaco-css that referenced this issue Jun 10, 2021
@aeschli aeschli added this to the May 2021 milestone Jun 10, 2021
@aeschli aeschli self-assigned this Jun 10, 2021
@aeschli
Copy link
Contributor

aeschli commented Jun 10, 2021

added new APIs to the css and html supports.

const data = {
	"version": 1.1,
	"properties": [
	  { "name": "foo", "description": "Foo property" }
	],
	"atDirectives": [
	  { "name": "@foo", "description": "Foo at directive" }
	],
	"pseudoClasses": [
	  { "name": ":foo", "description": "Foo pseudo class" }
	],
	"pseudoElements": [
	  { "name": "::foo", "description": "Foo pseudo elements" }
	]
  }

  monaco.languages.css.cssDefaults.setOptions({data: { useDefaultDataProvider: false, dataProviders: [ data ]}});
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"
		  }
		]
	  }
	]
  }

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

More information on the data format:
https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md
https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md

@y912765390
Copy link

I want to add two fields

1 the name here is the label and we want to put an insertText in there. For example, I think an insert with a tag that has several attributes would need to do this.

2 I think properties and events should be distinguished so that they have different signs of kind

So I think there should be an event as well as an attribute

1 similar comment
@y912765390
Copy link

I want to add two fields

1 the name here is the label and we want to put an insertText in there. For example, I think an insert with a tag that has several attributes would need to do this.

2 I think properties and events should be distinguished so that they have different signs of kind

So I think there should be an event as well as an attribute

@aeschli
Copy link
Contributor

aeschli commented Jul 6, 2021

@y912765390 feature requests for custom data would have to go against https://github.com/microsoft/vscode-custom-data (which defines the data format) and the https://github.com/microsoft/vscode-html-languageservice, which consumes the daa and creates proposals with labels etc.
That said, we currently don't have any resources or plans to extend the custom data syntax. Help is wanted, If you are interested, let me know.

@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
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities html
Projects
None yet
Development

No branches or pull requests

4 participants