-
Notifications
You must be signed in to change notification settings - Fork 47
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
allow leading space for bs:disable comments #108
Conversation
@@ -121,16 +121,13 @@ export class BrsFile { | |||
throw new Error(`File was already processed. Create a new instance of BrsFile instead. ${this.pathAbsolute}`); | |||
} | |||
|
|||
//split the text into lines | |||
let lines = util.getLines(fileContents); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice benefit, we no longer need to split the file contents by line and process it, since getIgnores
works on the list of tokens now.
/** | ||
* Small tokenizer for bs:disable comments | ||
*/ | ||
public tokenizeBsDisableComment(token: Token) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple little tokenizer/parser function that makes dealing with disable comments easier.
if (tokenized.disableType === 'line') { | ||
affectedRange = Range.create(token.range.start.line, 0, token.range.start.line, token.range.start.character); | ||
} else if (tokenized.disableType === 'next-line') { | ||
affectedRange = Range.create(token.range.start.line + 1, 0, token.range.start.line + 1, Number.MAX_SAFE_INTEGER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to find the length of the next line, but there's no real benefit to doing that, so just use MAX_SAFE_INTEGER instead because that will definitely match anything on the next line.
Currently the
bs:disable-line
andbs:disable-next-line
comments do not support leading spaces. There's no reason not to, so this PR fixes that.