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

Add Automated updated of autocomplete-css completions.json #398

Merged
merged 33 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2a5fafb
Initial Setup and parsing of data
confused-Techie Feb 22, 2023
34b22ae
Final touches, and lots of them
confused-Techie Feb 24, 2023
6758361
Fixed type in `completions.json` Removed unneeded files
confused-Techie Feb 24, 2023
9af1375
Spelling fix `seperators` -> `separators`
confused-Techie Feb 24, 2023
e3b63ef
Merge branch 'master' into update-autocomplete-css
confused-Techie Feb 25, 2023
9137f9d
Allow manual HTML tags replacement from MDN docs
confused-Techie Feb 25, 2023
705e0d9
Ensure `getValuesOfProp()` properly receives full `css` object rather…
confused-Techie Feb 25, 2023
2c5ecd0
Fixed parts of `update.js`, and fixed some tests, broke others
confused-Techie Feb 25, 2023
3570e56
Update packages/autocomplete-css/update.js
confused-Techie Feb 25, 2023
0b6fd03
Large rewrite to specs to allow for expansion and change of the autoc…
confused-Techie Feb 25, 2023
b15410e
Added implicitly defined keywords to `completions.js`
confused-Techie Feb 25, 2023
b9acc26
Last `completions.json` agnostic test
confused-Techie Feb 25, 2023
d4ebeec
Update README.md for new update process
confused-Techie Feb 25, 2023
7a746a7
Rename variables within `isValueInCompletions()`
confused-Techie Mar 2, 2023
1ad19ce
autocomplete-css: Run `node update.js`
DeeDeeG Mar 4, 2023
4eb9758
autocomplete-css: Put implicit values last
DeeDeeG Mar 4, 2023
a163e38
autocomplete-css: Refresh package-lock.json
DeeDeeG Mar 4, 2023
ebdd711
autocomplete-css: Handle recursion for appending implicit values
DeeDeeG Mar 4, 2023
1024076
autocomplete-css: Handle more recursion
DeeDeeG Mar 4, 2023
0ab4f7d
Update packages/autocomplete-css/update.js
confused-Techie Mar 5, 2023
7c1e1d3
Resolve the initial blank descriptions
confused-Techie Mar 5, 2023
732a353
Protect against collecting warnings and notices as descriptions
confused-Techie Mar 5, 2023
a2237f3
Also add checks to `svg/elements` to collect missing `marker`
confused-Techie Mar 7, 2023
f34341b
First manual property description, and implementation of it's functio…
confused-Techie Mar 7, 2023
0411904
Add all legacy alias' and more
confused-Techie Mar 7, 2023
b79cc7b
Add other alias' and property mappings
confused-Techie Mar 7, 2023
828f326
Add in stroke spec properties
confused-Techie Mar 7, 2023
46f96db
Many many others
confused-Techie Mar 7, 2023
e7feeac
Add manual property descriptions to reduce empties to 17
confused-Techie Mar 10, 2023
a27b70b
Finish adding all manual properties
confused-Techie Mar 10, 2023
2a3afcb
Resolve failing spec
confused-Techie Mar 11, 2023
39dcbd2
Revert "Resolve failing spec"
confused-Techie Mar 11, 2023
804bbda
Update packages/autocomplete-css/update.js
confused-Techie Mar 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,005 changes: 4,589 additions & 1,416 deletions packages/autocomplete-css/completions.json

Large diffs are not rendered by default.

163 changes: 163 additions & 0 deletions packages/autocomplete-css/cssValueDefinitionSyntaxExtractor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
// Due to the complexity of CSS Value Definition Syntax
// https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax
// We will go ahead and create a small parser for handling it.
// This parser is only intended to receive some syntax, and spit out an array
// of all valid value identifiers within it. Ignoring all special conventions of
// the syntax.

class CSSParser {
constructor(input) {
this.index = 0;
this.value = input;
this.out = [];

// Manage States
this.buffer = ""; // Used to store uncomplete values while looping.

// Definitions
this.keywords = {
"*": "Asterisk Multiplier",
"+": "Plus Sign Multiplier",
"?": "Question Mark Multiplier",
"#": "Hash Mark Multiplier",
"!": "Exclamation Point Multiplier"
};

this.separators = {
"&&": "Double Ampersand Combinator",
"||": "Double Bar Combinator",
"|": "Single Bar Combinator",
"[": "Open Bracket Combinator",
"]": "Close Bracket Combinator",
" ": "Juxtaposition Combinator",
"/": "Undocumented Seperator?"
};

this.startFold = "<"; // A foldable item would mean to stop parsing within.
this.endFold = ">";
this.startDiscardable = "{";
this.endDiscardable = "}";
}

parse() {
let cur = this.cur();

if (this.index === this.value.length || this.index > this.value.length) {
// We have hit the end of our index. Lets return
this.offLoadBuffer();
return this.out;
}

if (this.isStartDiscardable()) {
// We don't care about what's in here, until we hit the end of our discardable
this.offLoadBuffer();
while(!this.isEndDiscardable()) {
this.next();
}
this.next();
return this.parse();
}

if (this.isKeyword().status) {
// We don't actually care about keywords.
this.offLoadBuffer();
this.next(this.isKeyword().who.length);
return this.parse();
}

if (this.isSeparators().status) {
// We don't actually care about seperators
this.offLoadBuffer();
this.next(this.isSeparators().who.length);
return this.parse();
}

if (this.isStartFold()) {
let tmpValue = "";
while(!this.isEndFold()) {
tmpValue += this.cur();
this.next();
}
tmpValue += this.cur();
this.out.push(tmpValue);
this.next();
return this.parse();
}

if (!this.isStartDiscardable() && !this.isEndDiscardable() && !this.isKeyword().status && !this.isSeparators().status && !this.isStartFold() && !this.isEndFold()) {
this.buffer += this.cur();
this.next();
return this.parse();
}

}

offLoadBuffer() {
if (this.buffer.length > 0) {
this.out.push(this.buffer);
this.buffer = "";
}
}

isKeyword() {
for (const name in this.keywords) {
if (this.keywords.hasOwnProperty(name) && this.value.substr(this.index, name.length) === name) {
return { status: true, who: name };
}
}
return { status: false };
}

isSeparators() {
for (const name in this.separators) {
if (this.separators.hasOwnProperty(name) && this.value.substr(this.index, name.length) === name) {
return { status: true, who: name };
}
}
return { status: false };
}

isStartFold() {
if (this.cur() === this.startFold) {
return true;
} else {
return false;
}
}

isEndFold() {
if (this.cur() === this.endFold) {
return true;
} else {
return false;
}
}

isStartDiscardable() {
if (this.cur() === this.startDiscardable) {
return true;
} else {
return false;
}
}

isEndDiscardable() {
if (this.cur() === this.endDiscardable) {
return true;
} else {
return false;
}
}

cur() {
return this.value.charAt(this.index);
}

next(amount) {
let increase = amount ?? 1;
this.index = this.index + increase;
return this.value.charAt(this.index);
}
}

module.exports = CSSParser;
85 changes: 0 additions & 85 deletions packages/autocomplete-css/fetch-property-docs.coffee

This file was deleted.

114 changes: 0 additions & 114 deletions packages/autocomplete-css/html-tags.json

This file was deleted.

Loading