Skip to content

Commit

Permalink
Update analyzer defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Matsuuu committed Nov 8, 2023
1 parent 5ce3279 commit a608b5b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
4 changes: 4 additions & 0 deletions lib/custom-elements-languageserver-core/src/cem/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ const DEFAULT_CONFIG = {
dev: false,
packagejson: true,
litelement: true,
stencil: true,
fast: true,
catalyst: true,
'catalyst-major-2': true,
plugins: [

]
Expand Down
32 changes: 22 additions & 10 deletions lib/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,30 @@
## Usage

The best way to utilize the Custom Elements Language Server is to enable the [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest)(CEM) in your project by installing
a CEM generator like one provided by [The Open WC Team](https://github.com/open-wc/custom-elements-manifest/tree/master/packages/analyzer).

Generating a CEM in watch mode will provide you with the best user experience. If your dependencies ship with a Custom Elements Manifest, those will be utilized also.
Just install the plugin to your preferred system, and it should plug into your project.

## Features

The current featureset is as follows:

- Support HTML files and html`` -template literals
- Provides Completions for custom elements defined in the local Custom Elements Manifest and ones in node_modules
- Provides type hints for attributes and properties on html tages
- Provides Go To Definition -functionality for Custom Elements defined in the Custom Elements Manifest
- Provides diagnostics on missing imports and unclosed custom element tags
- Provides Completions for custom elements defined in the local Custom Elements Manifest and ones in node_modules
- Provides type hints for attributes and properties on html tages
- Provides Go To Definition -functionality for Custom Elements defined in the Custom Elements Manifest
- Provides diagnostics on missing imports and unclosed custom element tags

### Disabling diagnostics

Sometimes CELS might catch some diagnostics that might not be useful for your usecase.

Adding a comment anywhere in your code with the given code, will disable diagnostics for said file.

These diagnostics can be disbled with the following flags:

| Command | Action |
| --------------------------- | ------------------------------------------------------ |
| cels-disable-diagnostics | Disable all diagnostics |
| cels-disable-missing-closed | Disable diagnostics for non-closed custom element tags |
| cels-disable-import-check | Disable checks for non-imported custom elements |

## Installing

Expand All @@ -36,6 +46,9 @@ NeoVim supports LSP actions through the built in LSP. You will just need to inst

#### Install language server

Install the server plugin from [NPM](https://www.npmjs.com/package/custom-elements-languageserver)


```bash
npm install -g custom-elements-languageserver
```
Expand Down Expand Up @@ -63,5 +76,4 @@ These operations include but are not limited to
- Slot name autocompletions
- Event binding completions


Via installing a plugin to your favorite editor to support LSP actions, you are able to enable all of these Language Service functionalities.
2 changes: 1 addition & 1 deletion lib/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-elements-languageserver",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"main": "dist/server.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions usage-testing-project/src/card.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
import "./example-project.js";
interface Props {
title: string;
body: string;
Expand Down

0 comments on commit a608b5b

Please sign in to comment.