Skip to content
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

Use a single tab field separator in keywords.txt #401

Merged
merged 1 commit into from
Jul 15, 2018
Merged

Use a single tab field separator in keywords.txt #401

merged 1 commit into from
Jul 15, 2018

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Jul 15, 2018

Each field of keywords.txt is separated by a single true tab. When you use multiple tabs it causes the field to be interpreted as empty. On Arduino IDE 1.6.5 and newer an empty KEYWORD_TOKENTYPE causes the default editor.function.style coloration to be used (as with KEYWORD2, KEYWORD3, LITERAL2). On Arduino IDE 1.6.4 and older it causes the keyword to not be recognized for any special coloration.

Reference:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords

Each field of keywords.txt is separated by a single true tab. When you use multiple tabs it causes the field to be interpreted as empty. On Arduino IDE 1.6.5 and newer an empty KEYWORD_TOKENTYPE causes the default editor.function.style coloration to be used (as with KEYWORD2, KEYWORD3, LITERAL2). On Arduino IDE 1.6.4 and older it causes the keyword to not be recognized for any special coloration.

Reference:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords
@soundanalogous
Copy link
Member

Thanks for fixing this. Arduino should really just change their parser or move to an xml or json format for this. I'd imagine a large number of keywords.txt files are broken in a similar way across all of the Arduino libraries.

@soundanalogous soundanalogous merged commit cb78078 into firmata:master Jul 15, 2018
@per1234
Copy link
Contributor Author

per1234 commented Jul 15, 2018

Arduino should really just change their parser

There is work to change the parser (arduino/Arduino#7245) but they hvaen't settled on a good way to handle the intentional use of empty fields to skip the REFERENCE_LINK field for 3rd party libraries where there is no reference page for their keyword. After a promising start, progress seems to have stalled on that project so I'm not holding my breath.

or move to an xml or json format for this.

You're probably right. I think the current system was reasonable when there were only two fields in keywords.txt that a 3rd party library author needed to be concerned with but the addition of the RSYNTAXTEXTAREA_TOKENTYPE(https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#rsyntaxtextarea_tokentype) field made something that should be fairly simple way too complicated.

I'd imagine a large number of keywords.txt files are broken in a similar way across all of the Arduino libraries.

You're absolutely correct. With an automated scan, I found ~450 libraries with multiple tabs used as a separator where it caused incorrect highlighting. The scan found ~1000 additional libraries where spaces were used instead of tabs. And that after I've already fixed the spaces instead of tabs problem in hundreds of libraries over the last few years. There are even more where the bad formatting doesn't have any noticeable effect because the fallback theme setting happens to match what was intended but I'm skipping those for now because it makes it a tougher sell when there are no consequences of the bad formatting I propose to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants