Skip to content

Use correct field separator in keywords.txt #2

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

Merged
merged 1 commit into from
Jun 15, 2019
Merged

Use correct field separator in keywords.txt #2

merged 1 commit into from
Jun 15, 2019

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Jul 17, 2018

The Arduino IDE requires the use of a single true tab separator between the keyword name and identifier. When spaces are used rather than a true tab the keyword is not highlighted.

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

The Arduino IDE requires the use of a single true tab separator between the keyword name and identifier. When spaces are used rather than a true tab the keyword is not highlighted.

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

I hate tabs with a passion, because whenever source files have tabs in them the inevitably line up very poorly unless you happen to have the same tab stops set in your editor as the author, and different authors have different preferences. I use spaces in my code therefore.

I also think it is crazy for the IDE to "require" a single tab in order to syntax highlight a word. Can't they make a regexp that accepts "one or more space-type characters"? That is a standard PCRE regexp expression: \s+

@per1234
Copy link
Contributor Author

per1234 commented Jul 28, 2018

I'm also a spaces person. It's a struggle for me to work with keywords.txt because I have my editor set to replace tabs with spaces. I have it set to show markers for spaces and tabs and also have a browser extension that does that for GitHub pages so that's made me much more aware of whitespace.

Another common keywords.txt problem is people like to use multiple tabs to try to make everything line up pretty, and the Arduino IDE also does not work with that.

Some work was done to try to allow spaces: arduino/Arduino#7245 but it seems to have lost momentum. It's a bit more complex than it appears at first because you need to allow empty fields since not every keyword (especially 3rd party libraries) will have a reference page to put in the REFERENCE_LINK field. So the RSyntaxTextArea compliant (for Arduino IDE 1.6.5 and newer) keyword definition would look like this:

I2C_graphical_LCD_display	KEYWORD1		DATA_TYPE

where there are two tabs between KEYWORD1 and DATA_TYPE.

I don't have the skills to work on the IDE code so the best I can do is try to spread awareness of how keywords.txt formatting works. I don't see the problem quite as frequently anymore so I think my campaign is working to some extent. On the other hand, I've found that sometimes when I come back to a repo a few months after fixing their keywords.txt and spaces will have crept back in.

@nickgammon nickgammon merged commit 2b1437f into nickgammon:master Jun 15, 2019
@per1234 per1234 deleted the keywords-separator branch June 15, 2019 00:15
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