vaderjs 1.2.9 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/vader-min.js +1 -0
- package/vader.js +159 -132
- package/worker-min.js +1 -0
- package/worker.js +59 -9
- package/snippet-gen/vader/.vscode/launch.json +0 -17
- package/snippet-gen/vader/.vscodeignore +0 -4
- package/snippet-gen/vader/CHANGELOG.md +0 -9
- package/snippet-gen/vader/README.md +0 -26
- package/snippet-gen/vader/extension/extension.js +0 -70
- package/snippet-gen/vader/extension/html_completion/html_completion.js +0 -91
- package/snippet-gen/vader/extension/html_completion/html_completion.json +0 -1891
- package/snippet-gen/vader/icons/logo.png +0 -0
- package/snippet-gen/vader/language-configuration.json +0 -128
- package/snippet-gen/vader/package.json +0 -47
- package/snippet-gen/vader/snippets/vader.json +0 -13
- package/snippet-gen/vader/syntaxes/vader.tmLanguage.json +0 -2644
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const vscode = require('vscode');
|
|
2
|
-
const html_completes = require('./html_completion/html_completion');
|
|
3
|
-
function activate(context) {
|
|
4
|
-
|
|
5
|
-
let completes = []
|
|
6
|
-
const include = vscode.languages.registerCompletionItemProvider(
|
|
7
|
-
'vader',
|
|
8
|
-
{
|
|
9
|
-
provideCompletionItems(document, position) {
|
|
10
|
-
const linePrefix = document.lineAt(position).text.trim();
|
|
11
|
-
if(!linePrefix.startsWith('in')) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
let complete = new vscode.CompletionItem('include()', vscode.CompletionItemKind.Function);
|
|
15
|
-
complete.insertText = new vscode.SnippetString('include("${1:file}")');
|
|
16
|
-
|
|
17
|
-
complete.tags = [vscode.CompletionItemTag.Deprecated]
|
|
18
|
-
|
|
19
|
-
complete.documentation = new vscode.MarkdownString(`Include a view file into your template\n - @param \`\string\`\ file - The file to include\n- @returns {string} - the parsed html code to client`, true)
|
|
20
|
-
return [complete]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
const comment = vscode.languages.registerCompletionItemProvider('vader', {
|
|
26
|
-
provideCompletionItems(document, position) {
|
|
27
|
-
const linePrefix = document.lineAt(position).text.slice(0, position.character);
|
|
28
|
-
if(!linePrefix.includes('-')) {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
let complete = new vscode.CompletionItem('-', vscode.CompletionItemKind.Property);
|
|
32
|
-
complete.insertText = new vscode.SnippetString('-- \n ${1:comment} \n--');
|
|
33
|
-
complete.documentation = new vscode.MarkdownString(`Create a multi line comment`, true)
|
|
34
|
-
return [complete]
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
}, )
|
|
38
|
-
|
|
39
|
-
const syntaxeror = vscode.languages.registerCompletionItemProvider('vader', {
|
|
40
|
-
provideCompletionItems(document, position) {
|
|
41
|
-
let firstline = document.lineAt(0).text.trim();
|
|
42
|
-
let lastline = document.lineAt(document.lineCount - 1).text.trim();
|
|
43
|
-
if(!firstline.includes('body') || !lastline.includes('body')) {
|
|
44
|
-
|
|
45
|
-
vscode.window.showWarningMessage('Syntax error: missing <body> tag in template\n vader may cut off your code if not present')
|
|
46
|
-
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const includehover = vscode.languages.registerHoverProvider('vader', {
|
|
56
|
-
provideHover(document, position) {
|
|
57
|
-
const linePrefix = document.lineAt(position).text.slice(0, position.character);
|
|
58
|
-
if (!linePrefix.startsWith('in')) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
let complete = new vscode.Hover(new vscode.MarkdownString(`Include a view file into your template\n - @param {string} file - The file to include\n- @returns {string} - the parsed html code to client`, true))
|
|
62
|
-
return complete
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
context.subscriptions.push(include, html_completes, comment, includehover, syntaxeror,completes);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
module.exports.activate = activate;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
const vscode = require('vscode');
|
|
2
|
-
let completes = []
|
|
3
|
-
const html_completes = vscode.languages.registerCompletionItemProvider('vader', {
|
|
4
|
-
provideCompletionItems(document, position) {
|
|
5
|
-
let line = document.lineAt(position).text.trim();
|
|
6
|
-
|
|
7
|
-
let {tags, attributes} = JSON.parse(require('fs').readFileSync(require('path').join(__dirname, 'html_completion.json'), 'utf8'))
|
|
8
|
-
|
|
9
|
-
let items = []
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
for(tag in tags){
|
|
14
|
-
|
|
15
|
-
if(!line.startsWith('<') && !line.endsWith('>')){
|
|
16
|
-
continue
|
|
17
|
-
}
|
|
18
|
-
let complete = new vscode.CompletionItem(tag, tags[tag].type && tags[tag].type === "keyword" ? vscode.CompletionItemKind.Keyword : vscode.CompletionItemKind.Module);
|
|
19
|
-
// make sure its not in range between a entering < and closing > with a space in between
|
|
20
|
-
if(line.startsWith('<') && line.endsWith('>') && line.includes(' ')){
|
|
21
|
-
// remove the tag from the completion
|
|
22
|
-
let line = document.lineAt(position).text.trim();
|
|
23
|
-
complete.range = new vscode.Range(new vscode.Position(position.line, line.indexOf('<')), new vscode.Position(position.line, line.indexOf('<') + tag.length))
|
|
24
|
-
}
|
|
25
|
-
complete.insertText = new vscode.SnippetString(tags[tag].body);
|
|
26
|
-
if(tags[tag].deprecated){
|
|
27
|
-
complete.tags = [vscode.CompletionItemTag.Deprecated]
|
|
28
|
-
}
|
|
29
|
-
complete.documentation = new vscode.MarkdownString(tags[tag].description, true)
|
|
30
|
-
items.push(complete)
|
|
31
|
-
}
|
|
32
|
-
for(attribute in attributes){
|
|
33
|
-
let line = document.lineAt(position).text.trim();
|
|
34
|
-
if(line.includes('<') || line.includes('>') ){
|
|
35
|
-
let tag = line.split('<')[1] ? line.split('<')[1].split('>')[0].split(' ')[0] : line.split('>')[0]
|
|
36
|
-
let valid_in = attributes[attribute].valid_in
|
|
37
|
-
if(valid_in.includes(tag) || valid_in.includes('*')){
|
|
38
|
-
let complete = new vscode.CompletionItem(attribute, vscode.CompletionItemKind.Property);
|
|
39
|
-
if(attributes[attribute].deprecated){
|
|
40
|
-
complete.tags = [vscode.CompletionItemTag.Deprecated]
|
|
41
|
-
}
|
|
42
|
-
complete.insertText = new vscode.SnippetString(attributes[attribute].body);
|
|
43
|
-
complete.documentation = new vscode.MarkdownString(attributes[attribute].description, true)
|
|
44
|
-
items.push(complete)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return items
|
|
52
|
-
},
|
|
53
|
-
} , )
|
|
54
|
-
|
|
55
|
-
const hovercompletes = vscode.languages.registerHoverProvider('vader', {
|
|
56
|
-
provideHover(document, position) {
|
|
57
|
-
let selection = document.getText(document.getWordRangeAtPosition(position));
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let {tags, attributes} = JSON.parse(require('fs').readFileSync(require('path').join(__dirname, 'html_completion.json'), 'utf8'))
|
|
61
|
-
let line = document.lineAt(position.line).text.trim();
|
|
62
|
-
|
|
63
|
-
// make sure no attributes are in the hover position
|
|
64
|
-
if (selection === line.split('<')[1].split('>')[0].split(' ')[0]) {
|
|
65
|
-
let tag = line.split('<')[1].split('>')[0].split(' ')[0]
|
|
66
|
-
if (tags[tag]) {
|
|
67
|
-
return new vscode.Hover(new vscode.MarkdownString(tags[tag].description, true))
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// get the parent tag
|
|
71
|
-
let parent_tag = line.split('<')[1].split('>')[0].split(' ')[0]
|
|
72
|
-
// get the attribute
|
|
73
|
-
let tag_attributes = line.split('<')[1].split('>')[0].split(' ')
|
|
74
|
-
for (let i = 0; i < tag_attributes.length; i++) {
|
|
75
|
-
let attribute = tag_attributes[i]
|
|
76
|
-
if (attribute.includes('=')) {
|
|
77
|
-
attribute = attribute.split('=')[0]
|
|
78
|
-
}
|
|
79
|
-
if (attribute === selection) {
|
|
80
|
-
if (attributes[attribute]) {
|
|
81
|
-
return new vscode.Hover(new vscode.MarkdownString(attributes[attribute].description, true))
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return null; // Return null if no matching tag or attribute is found.
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
completes.push(html_completes, hovercompletes)
|
|
90
|
-
|
|
91
|
-
module.exports = completes
|