Skip to content

Commit

Permalink
Merge pull request #7 from georgejecook/fix/update-to-bsc-0.59.0
Browse files Browse the repository at this point in the history
Fix/update to bsc 0.60.5
  • Loading branch information
georgejecook committed Nov 4, 2022
2 parents af355dd + 95fff2b commit 58b2e03
Show file tree
Hide file tree
Showing 6 changed files with 348 additions and 293 deletions.
29 changes: 15 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/node_modules": true,
"**/.nyc_output": true,
"**/coverage": true,
"**/dist": true
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/node_modules": true,
"**/.nyc_output": true,
"**/coverage": true,
"**/dist": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/dist": true
"**/node_modules": true,
"**/bower_components": true,
"**/dist": true
},
"editor.tabSize": 4,
"editor.insertSpaces": true,
"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
"files.trimTrailingWhitespace": true
}
"files.trimTrailingWhitespace": true,
"cSpell.words": ["undent"]
}
55 changes: 33 additions & 22 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "roku-log-bsc-plugin",
"version": "0.6.0",
"version": "0.6.1",
"description": "Visual studio plugin for roku logger",
"files": [
"dist/**/!(*.spec.*)*"
Expand All @@ -26,7 +26,7 @@
"@types/sinon": "^9.0.4",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"brighterscript": "^0.52.1",
"brighterscript": "^0.60.5",
"chai": "^4.2.0",
"chai-files": "^1.4.0",
"chai-subset": "^1.6.0",
Expand Down
40 changes: 40 additions & 0 deletions src/RawCodeStatement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type {
BscFile,
WalkOptions,
WalkVisitor
} from 'brighterscript';
import {
Range,
Statement
} from 'brighterscript';

import { SourceNode } from 'source-map';

import type { BrsTranspileState } from 'brighterscript/dist/parser/BrsTranspileState';

export class RawCodeStatement extends Statement {
constructor(
public source: string,
public sourceFile?: BscFile,
public range: Range = Range.create(1, 1, 1, 99999)
) {
super();
}

public transpile(state: BrsTranspileState) {
//indent every line with the current transpile indent level (except the first line, because that's pre-indented by bsc)
let source = this.source.replace(/\r?\n/g, (match, newline) => {
return state.newline + state.indent();
});

return [new SourceNode(
this.range.start.line + 1,
this.range.start.character,
this.sourceFile ? this.sourceFile.pathAbsolute : state.srcPath,
source
)];
}
public walk(visitor: WalkVisitor, options: WalkOptions) {
//nothing to walk
}
}
Loading

0 comments on commit 58b2e03

Please sign in to comment.