Coder Social home page Coder Social logo

break-stuff / cem-plugin-vs-code-custom-data-generator Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 2.0 17.52 MB

A custom elements manifest analyzer plugin to generate a custom data file for VS Code.

License: MIT License

JavaScript 1.08% TypeScript 98.92%

cem-plugin-vs-code-custom-data-generator's People

Contributors

break-stuff avatar claviska avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cem-plugin-vs-code-custom-data-generator's Issues

String values get autocompleted with extra quotes

I'm reporting this issue to track it but, unfortunately, I don't have time today to jump in and fix it myself. Consider the following property defined in Lit:

/** The button's variant. */
@property({ reflect: true }) variant: 'default' | 'primary' | 'success' | 'neutral' | 'warning' | 'danger' | 'text' = 'default';

The resulting CEM data looks like this:

"attributes": [
  {
    "name": "variant",
    "type": {
      "text": "'default' | 'primary' | 'success' | 'neutral' | 'warning' | 'danger' | 'text'"
    },
    "default": "'default'",
    "description": "The button's variant.",
    "fieldName": "variant"
  }
]

Note the extra single quotes shown in the default property. These end up in the autocomplete data:

CleanShot.2022-11-22.at.09.07.18.mp4

camelCased attribute name picked up instead of kebab-case name

Thanks for such a cool plugin!

I'm working on a JS-based LitElement custom element with JSCode comments, and I have a property called fixedWidth which I want to use as fixed-width for the HTML attribute. However, the plugin is generating the vscode.html-custom-data.json file with fixedWidth as the attribute name instead of fixed-width. I think it's due to this particular line:

If I reverse that to attr.name || attr.fieldName, then the json output seems correct to me (but perhaps that would inadvertently cause some other issue I'm not aware of).

Thoughts?

Discussion: is there value in creating a section dedicated to attributes in the contextual information?

First, thank you for this plugin. We're using it to great success in our Lit component library.

I didn't see anything related to this yet, but I was wondering if there's any value in displaying a component's attributes in the contextual information tooltip? It's great to see all of an element's slots, events, etc. and - at least personally - would find it useful to see what attributes/props are available in the area.

With the way it works now, the autocomplete of attributes and their details works so long as you know what attribute you're looking for. If you could see the list of custom attributes alongside the slots and events , it can save time in looking them up.

Thoughts?

Install instructions

Hello, i'm not sure to have understood how to use this useful plugin.

  • Install via repo manager as a dev dependency in a project (OK)
  • create custom-elements-manifest.config.js file and export generateCustomData (correct?)
  • edit settings.json introducing html-custom-data.json (where is this file from? is it something inside vsc?)
  • tag mapping has to be done manually (correct?)

Thank you for clarifications

Node.js 14 support

This plugin uses String.replaceAll() which wasn't introduced until Node 15. This causes a problem for Shoelace users running Node 14. See shoelace-style/shoelace#1172 for details.

I didn't see any mention of which Node versions are specifically supported in your repo. Are you OK with switching out replaceAll() with a regex instead to support Node 14+, or are you intentionally targeting a higher version?

Generated File is Empty

Hi There,

Hoping this is the right place. Was looking at how shoelace makes the intelisense work and tried to do the same thing.
The results is in this repo but when doing so the vscode.css-custom-data.json file just came up empty.

git checkout 1010-add-schemas
npm i
npx cem analyze

Diff -> https://github.com/infor-design/enterprise-wc/pull/new/1010-add-schemas
You can see that custom-elements.json looks right but vscode.html-custom-data.json is empty.

Any suggestions you can offer? Is this the only tool that puts custom-elements.json in vs code format?
Or any way to debug?

Also should https://github.com/break-stuff/cem-plugin-vs-code-custom-data-generator/blob/main/package.json#L34 be a devDependency ?

Thanks!

License?

I noticed this doesn't have a license. I believe by default no license means usage is as restrictive as possible, but I don't know how all that works with it being published on npm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.