Skip to content

Commit

Permalink
JetBrains IDE Integration (#1512)
Browse files Browse the repository at this point in the history
* upgrade vs code integration package

* add references

* add web-types plugin

* update reference

* run prettier

* update documentation

* run prettier

* remove test script
  • Loading branch information
break-stuff authored Aug 14, 2023
1 parent 6f08f50 commit aeef986
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 73 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ docs/assets/images/sprite.svg
node_modules
src/react
cdn
web-types.json
10 changes: 10 additions & 0 deletions custom-elements-manifest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as path from 'path';
import { customElementJetBrainsPlugin } from 'custom-element-jet-brains-integration';
import { customElementVsCodePlugin } from 'custom-element-vs-code-integration';
import { parse } from 'comment-parser';
import { pascalCase } from 'pascal-case';
Expand Down Expand Up @@ -200,6 +201,15 @@ export default {
url: `https://shoelace.style/components/${tag.replace('sl-', '')}`
}
]
}),
customElementJetBrainsPlugin({
excludeCss: true,
referencesTemplate: (_, tag) => {
return {
name: 'Documentation',
url: `https://shoelace.style/components/${tag.replace('sl-', '')}`
};
}
})
]
};
6 changes: 6 additions & 0 deletions docs/pages/getting-started/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ Shoelace ships with a file called `vscode.html-custom-data.json` that can be use

If `settings.json` already exists, simply add the above line to the root of the object. Note that you may need to restart VS Code for the changes to take affect.

## JetBrains IDEs

If you are using a [JetBrains IDE](https://www.jetbrains.com/) and you are installing Shoelace from NPM, the editor will automatically detect the `web-types.json` file from the package and you should immediately see component information in your editor.

If you are installing from the CDN, you can [download a local copy](https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace/cdn/web-types.json) and add it to the root of your project.

### Other Editors

Most popular editors support custom code completion with a bit of configuration. Please [submit a feature request](https://github.com/shoelace-style/shoelace/issues/new/choose) for your editor of choice. PRs are also welcome!
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Cory LaViska",
"license": "MIT",
"customElements": "dist/custom-elements.json",
"web-types": "dist/web-types.json",
"web-types": "./web-types.json",
"type": "module",
"types": "dist/shoelace.d.ts",
"jsdelivr": "./cdn/shoelace-autoloader.js",
Expand Down Expand Up @@ -95,6 +95,7 @@
"command-line-args": "^5.2.1",
"comment-parser": "^1.3.1",
"cspell": "^6.18.1",
"custom-element-jet-brains-integration": "^1.1.0",
"custom-element-vs-code-integration": "^1.1.0",
"del": "^7.0.0",
"download": "^8.0.0",
Expand Down
5 changes: 1 addition & 4 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ await nextTask('Wrapping components for React', () => {
return execPromise(`node scripts/make-react.js --outdir "${outdir}"`, { stdio: 'inherit' });
});

await nextTask('Generating Web Types', () => {
return execPromise(`node scripts/make-web-types.js --outdir "${outdir}"`, { stdio: 'inherit' });
});

await nextTask('Generating themes', () => {
return execPromise(`node scripts/make-themes.js --outdir "${outdir}"`, { stdio: 'inherit' });
});
Expand All @@ -207,6 +203,7 @@ await nextTask('Running the TypeScript compiler', () => {
// Copy the above steps to the CDN directory directly so we don't need to twice the work for nothing.
await nextTask(`Copying Web Types, Themes, Icons, and TS Types to "${cdndir}"`, async () => {
await deleteAsync(cdndir);
await copy('./web-types.json', `${outdir}/web-types.json`);
await copy(outdir, cdndir);
});

Expand Down
68 changes: 0 additions & 68 deletions scripts/make-web-types.js

This file was deleted.

0 comments on commit aeef986

Please sign in to comment.