Skip to content

Commit

Permalink
Add print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Oct 17, 2024
1 parent e2b3881 commit 4844582
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"request": "launch",
"host": "${promptForHost}",
"rootDir": "${workspaceFolder}/out/dist",
"preLaunchTask": "build-test-app"
"preLaunchTask": "build-test-app",
"enableDebugProtocol": true
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"files.trimTrailingWhitespace": true,
"typescript.tsdk": "node_modules\\typescript\\lib",
"brightscript.bsdk": "1.0.0-alpha.39"
"brightscript.bsdk": "embedded"
}
2 changes: 2 additions & 0 deletions lib/components/Reftracker.bs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function processNextNode()

nodeQueueItem = m.nodeQueue.pop()

print `reftracker: processing node ${nodeQueueItem.keypath}<${nodeQueueItem.node.subtype()}>`

return promises.chain(promises.resolve(true), nodeQueueItem).then(function(result, queueItem as NodeQueueItem)
'if this node supports reftracker functionality, process the node's internal `m`
if (nodeQueueItem.node as dynamic).reftrackerEnabled then
Expand Down
2 changes: 2 additions & 0 deletions lib/source/reftrackerLib.bs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ namespace reftracker.internal

itemType = type(item)

print `reftracker: processing item ${item.keypath} (${itemType}`

'if this is a node, push register it with the reftracker to be processed later
if itemType = "roSGNode"
tracker@.registerNodeRef(item)
Expand Down
21 changes: 14 additions & 7 deletions src/Plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fsExtra from 'fs-extra';
import * as fastGlob from 'fast-glob';
import type { BeforeFileTranspileEvent, CompilerPlugin, Editor, Program, XmlFile } from 'brighterscript';
import { createSGAttribute, isBrsFile, isXmlFile, standardizePath as s } from 'brighterscript';
import type { BeforeFileTranspileEvent, BscFile, CompilerPlugin, Editor, Program, XmlFile } from 'brighterscript';

Check failure on line 3 in src/Plugin.ts

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

'BeforeFileTranspileEvent' is declared but never used.

Check failure on line 3 in src/Plugin.ts

View workflow job for this annotation

GitHub Actions / ci (macos-latest)

'BeforeFileTranspileEvent' is declared but never used.
import { AstEditor, createSGAttribute, isBrsFile, isXmlFile, standardizePath as s } from 'brighterscript';

Check failure on line 4 in src/Plugin.ts

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

'isBrsFile' is declared but its value is never read.

Check failure on line 4 in src/Plugin.ts

View workflow job for this annotation

GitHub Actions / ci (macos-latest)

'isBrsFile' is declared but its value is never read.
import { SGField, SGFunction, SGInterface, SGScript } from 'brighterscript/dist/parser/SGTypes';
const cwd = s`${__dirname}/../`;

Expand All @@ -22,15 +22,22 @@ export class Plugin implements CompilerPlugin {
}
}

beforeFileTranspile(event: BeforeFileTranspileEvent) {
if (isBrsFile(event.file)) {

} else if (isXmlFile(event.file)) {
afterFileParse(file: BscFile) {
if (isXmlFile(file)) {
//inject the reftracker.bs file as a reference
this.injectScriptAndCallfunc(event.file, event.editor);
this.injectScriptAndCallfunc(file, new AstEditor());
}
}

// beforeFileTranspile(event: BeforeFileTranspileEvent) {
// if (isBrsFile(event.file)) {

// } else if (isXmlFile(event.file)) {
// //inject the reftracker.bs file as a reference
// this.injectScriptAndCallfunc(event.file, event.editor);
// }
// }

private injectScriptAndCallfunc(file: XmlFile, editor: Editor) {
//inject the script tag
if (!file.ast.component?.api) {
Expand Down
6 changes: 4 additions & 2 deletions test-project/components/MainScene.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ sub init()
m.mainLabel = m.top.findNode("mainLabel")
'change the color
m.mainLabel.color = "0xFFFFFF"
'make the text really big
'make the text really big
m.mainLabel.font.size = 100
end sub

reftracker.findNodeById("bob")
end sub

0 comments on commit 4844582

Please sign in to comment.