Skip to content

Commit

Permalink
Updated list of supported element props. (#6)
Browse files Browse the repository at this point in the history
* Updated list of supported element props.

* version bumped to 0.3.1

---------

Co-authored-by: Uğur Aslan <[email protected]>
  • Loading branch information
michielvandergeest and uguraslan authored Oct 4, 2023
1 parent a6b4a08 commit 8821ac8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 29 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "blits-vscode",
"displayName": "blits-vscode",
"description": "Visual Studio Code extension for Blits",
"version": "0.3.0",
"version": "0.3.1",
"engines": {
"vscode": "^1.81.0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/completionItems/componentProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const path = require('path')
const fs = require('fs-extra')
const parse = require('../parsers')
const templateHelper = require('../helpers/template')
const coreProps = require('./coreProps')
const elementProps = require('./elementProps')

module.exports = async (tag, attributes, doc, docAst) => {
let completionItems = []
Expand Down Expand Up @@ -80,8 +80,8 @@ module.exports = async (tag, attributes, doc, docAst) => {
}

// always merge with core props
const coreCompletionItems = await coreProps(attributes)
completionItems = completionItems.concat(coreCompletionItems)
const elementCompletionItems = await elementProps(attributes)
completionItems = completionItems.concat(elementCompletionItems)

return completionItems
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,30 @@
const vscode = require('vscode')

// temporary solution
const coreNodeProps = [
const elementProps = [
'x',
'y',
'w',
'width',
'h',
'height',
'z',
'zIndex',
'alpha',
'color',
'colorTop',
'colorBottom',
'colorLeft',
'colorRight',
'colorTl',
'colorTr',
'colorBl',
'colorBr',
'parent',
'zIndex',
'texture',
'textureOptions',
'shader',
'shaderProps',
'zIndexLocked',
'scale',
'rotation',
'mount',
'mountX',
'mountY',
'pivot',
'pivotX',
'pivotY',
'rotation',
'src',
'ref',
'effects'
]

module.exports = async (attributes) => {
let completionItems = []
coreNodeProps.forEach((prop) => {
elementProps.forEach((prop) => {
if (!attributes.includes(prop)) {
const completionItem = new vscode.CompletionItem(
prop,
Expand Down
2 changes: 1 addition & 1 deletion src/completionItems/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

module.exports = {
componentProps: require('./componentProps'),
coreProps: require('./coreProps'),
elementProps: require('./elementProps'),
}
2 changes: 1 addition & 1 deletion src/completionProviders/templateAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = vscode.languages.registerCompletionItemProvider(
if (tagName) {
// hardcoded for now, Blits will provide a map for rendererer props
if (tagName === 'Element') {
return await completionItems.coreProps(
return await completionItems.elementProps(
tagName,
attributes,
document,
Expand Down

0 comments on commit 8821ac8

Please sign in to comment.