Skip to content

Commit c47c64a

Browse files
new README
1 parent 353762b commit c47c64a

7 files changed

Lines changed: 86 additions & 87 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ src/document/css-document
1111
src/document/experiments
1212
*.png
1313
out/
14+
demo.js
15+
demo.js.map
16+
demo.ts
1417

1518
# User-specific files
1619
*.rsuser

README.md

Lines changed: 83 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Lit-HTML & Styled Components Extension
22

3-
A VS Code extension that provides syntax highlighting and diagnostic features for lit-html templates and styled-components in JavaScript/TypeScript projects.
3+
A VS Code extension that provides syntax highlighting and diagnostic features for lit-html templates, styled-components and css-templates in JavaScript/TypeScript projects.
44
This project builds on the Base-Custom-Components project.
55

66
## Features
@@ -61,25 +61,17 @@ static style = css`
6161

6262
#### Commands
6363

64-
Hello World: Sample command (Ctrl+Shift+P → "Hello World")
65-
Development
66-
Project Structure
64+
No command is required.
6765

6866
### Development
6967

7068
```Text
7169
├── src/
7270
│ ├── [extension.ts](http://_vscodecontentref_/0) #Main entry point of the extension
73-
│ ├── internalPrinter.ts # Logging utilities
74-
│ ├── document/
75-
│ │ ├── html-document/ # HTML parsing logic
76-
│ │ ├── css-document/ # CSS parsing logic
77-
│ │ ├── syntaxes/ # Syntax grammar definitions
78-
│ │ └── experiments/ # AST analysis and tests
79-
│ ├── utils/
80-
│ │ └── allowed-tags.ts # Allowed HTML tags
81-
│ └── test/
82-
│ └── extension.test.ts # Unit tests
71+
│ ├── class/ # Validator-objects
72+
│ ├── document/ # Syntax-highlighting-logic
73+
│ ├── utils/ # Help components
74+
| ├── interface/ # Required interfaces
8375
```
8476

8577
### Dependencies
@@ -88,10 +80,11 @@ Important Dependencies
8880

8981
```Text
9082
parse5: HTML5-compliant parser
91-
node-html-parser: Fast HTML parser
9283
lit-analyzer: Analysis tools for lit-html
9384
vscode-html-languageservice: HTML language services
9485
vscode-css-languageservice: CSS language services
86+
vscode: Main accesspoint to the file & diagnostic
87+
typescript: Typescript types
9588
```
9689

9790
### Technical Details
@@ -109,6 +102,81 @@ Known Limitations
109102
The extension is under active development
110103
Some experimental features are still in the experiments/ folder
111104

105+
## Project Structure
106+
107+
### 📁 Interfaces
108+
109+
Contains custom type definitions and interfaces for type safety and structure clarity.
110+
111+
### 📁 Utils
112+
113+
Helper functions that provide core functionality:
114+
115+
- `createPosition.ts` - Creates global document offset positions.
116+
117+
- `createVscodeDiagnostic.ts` - Creates a vscode diagnostic.
118+
119+
- `extractHtmlTemplateBlock.ts` - Extracts single html line for `extractHtmlTagWithAttr.ts`
120+
121+
```html
122+
<input type="checkbox" .checked="{{this.ee}}">
123+
```
124+
125+
- `extractHtmlTagWithAttr.ts` - Extracts a whole tag with its attributes for createTagData.
126+
127+
```Text
128+
input
129+
├──Attr
130+
| ├── type
131+
| ├── .checked
132+
├──pos
133+
├── startoff
134+
├── endoff
135+
```
136+
137+
- `createTagData.ts` - Creates a tag with its attributes and positions.
138+
139+
- `internalPrinter.ts` - Helper for debugging.
140+
141+
- `extractHtmlCssTemplateBlock.ts & extractHtmlCssTemplateBlock.ts` - Extracts a whole tagged templateblock
142+
143+
```typescript
144+
static templatef = html`
145+
<div>[[this.bb]]</div>
146+
<input type="checkbox" .checked="{{this.ee}}">Value: [[this.ee]]
147+
<div>[[this.bb]]</div>
148+
`;
149+
static style = css`
150+
:host {
151+
font-size: 20px;
152+
}`
153+
```
154+
155+
### 📁 Document
156+
157+
Contains the logic for finding and processing tagged template literals.
158+
159+
### 📁 Class
160+
161+
Core validation and parsing classes:
162+
163+
- `HtmlValidator` - Logic for html syntax
164+
165+
- `CssValidator` - Logic for html syntax
166+
167+
- `CustomElement` - The central class of the project that handles custom element processing and validation. To add custom attributes for a specific tag, please add it here in the right place in the hierarchie.
168+
169+
```Text
170+
{
171+
name: 'input',
172+
description: 'Custom web component',
173+
attributes: [
174+
{ name: 'a-random-valid-tag-only-for-input', description: 'Custom attribute' }
175+
]
176+
}, ...
177+
178+
```
179+
112180
##### Autor
113181

114182
Developed by Emmanuel Youssef as part of a practical project in Semester 5 at Kardex Holding AG.

demo.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

demo.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

demo.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,9 @@
118118
"typescript-eslint": "^8.52.0"
119119
},
120120
"dependencies": {
121-
"domutils": "^3.2.2",
122-
"html-dom-parser": "^5.1.8",
123-
"html5parser": "^2.0.2",
124-
"htmlparser2": "^10.1.0",
125-
"jsdom": "^28.0.0",
126121
"lit-analyzer": "^2.0.3",
127122
"node-html-parser": "^7.0.2",
128123
"parse5": "^8.0.0",
129-
"performant-array-to-tree": "^1.11.0",
130-
"tree-model": "^1.0.7",
131124
"vscode-css-languageservice": "^6.3.9",
132125
"vscode-html-languageservice": "^5.6.1"
133126
}

src/utils/allowedTags.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
export class TagContext {
32
static ALLOWED_TAGS = new Set<string>([ // in lit plugin suchen, da wird eine funktion verwendet die alle html tags zurück gibt
43
".checked","ichbinungultig"

0 commit comments

Comments
 (0)