-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Tracking issue] Token types guarantee #3170
Comments
I'm looking at systemd right now, and I'm noticing some inconsistencies between systemd, INI, and editorconfig. These three file types generally have These three file types also have prism/components/prism-editorconfig.js Lines 4 to 13 in 441a142
Lines 13 to 24 in 441a142
prism/components/prism-systemd.js Lines 15 to 25 in 441a142
Officially, editorconfig calls them Section Headers, INI calls them stanza names, and systemd calls them sections. Regardless of the main token name, they do not have consistent aliases. I'm not very sure what to do here! This is what I'm thinking:
|
Hard to say. Syntactically speaking, Honestly, I think both
That depends on who you ask. To my knowledge, there is no official spec for INI, so I don't think we have to worry about names here.
Hmmm. Since the headers and sections all have the same function, I would favor giving them the same name. I would call of all of them "section". These languages aren't so complex or popular that we have to offer very granular token names, so I think it's ok to go for more generic names.
Good idea. |
I'm looking at AutoIt right now (docs), and I'm not very sure about this one: prism/components/prism-autoit.js Lines 21 to 25 in 081d515
This will highlight stuff like The rest of it looks fine to me though! |
Huh, that's just a good old bug that needs some fixing. Do you want to make a PR, or shall I? However, regex bugs don't have anything to do with token types, so you can mark AutoIt as done. |
Hmm, I'd like to give it a shot, is this right? pattern: /(^[\t ]*)#[\w-]+/m |
Yup, that works. Thank you for taking this on. |
Hmm, I'm not super sure about this one: Line 12 in c30b736
Ada simply calls it an attribute, and it is defined in the 2012 Language Reference Manual (page 98 on the version without change bars): Is |
You're right. Some name like |
@RunDevelopment I see! I'll make a PR for it. Also, I just quickly looked through the other languages, I don't think there's any more config-type languages that don't use prism/components/prism-ignore.js Lines 5 to 16 in c30b736
Though it's a slightly different question: is |
Well, ignore (think
I'm not sure about "most" suitable, but it's a pretty good IMO. Entries in ignore file will be file path and file path patterns, so Apart from |
I guess Overall, I think keeping it as it is is alright! |
I'm having some doubts about AutoHotkey 😅 First of all, with respect to the token types guarantee, I'm not sure about the following tokens and how they are classified ( prism/components/prism-autohotkey.js Lines 25 to 35 in c30b736
Secondly, based on this Alphabetical Command and Function index, it seems that there are bunch that are missing, such as |
Same, but I highly doubt that
They were probably added to the language after our AutoIt grammar was last updated by someone. This is the reason we typically try to avoid long list of function/type/command names. Regarding directives (currently |
Same! I really have no idea which token we can use for it. I wanted to call it a
I see your point, do you think it's possible to write another regex that can replace (some of) the lists? I'm not familiar enough with regex to answer this 😅
I appreciate your wisdom! Would you like to make the PR for it? It would be nice to use |
Sorry to bring up another topic! I'm looking at Erlang, and it seems pretty alright, but I have a question about the prism/components/prism-erlang.js Lines 28 to 29 in cde0b5b
I'm not sure whether the keywords there should be classified as |
Regarding Autohotkey:
I think I'll make a PR with that. Not sure if all of those changes are that great, but they're probably a little better than what we have now. Let's continue the discussion about this topic there.
Done. |
Don't worry. You're a great help, so don't hesitate to ask.
Honestly, I'm not sure what to do about them myself... They fit into both |
Sounds great, thank you 😄 |
I'm currently looking at MEL (Maya Embedded Language), it seems mostly fine, but I have some questions: MEL has flags, and they are currently aliased to Lines 21 to 24 in 31a38d0
I'm not really sure if Next, there's Lines 3 to 14 in cf38d05
I don't think Finally there are built-in commands (very long list! Probably even longer than AutoHotKey!). Line 26 in cf38d05
Prism currently calls them |
I'm looking at Flow, and I'm not sure if prism/components/prism-flow.js Lines 5 to 10 in cf38d05
I'm thinking maybe Flow also has prism/components/prism-flow.js Line 12 in cf38d05
In JS, it's aliased to |
I'm looking at Excel formula: I wonder if prism/components/prism-excel-formula.js Lines 40 to 43 in cf38d05
I also see why prism/components/prism-excel-formula.js Lines 44 to 59 in cf38d05
But perhaps Also, as a note, I haven't really been paying attention to the colours, so there's a chance that the tokens will end up having the same colours in some themes 😅 |
I agree,
Yeah,
Oof. 16kb of built-in commands... Yes,
Procedure calls will be very difficult to detect because the parenthesis are optional. Procedure definition might be doable, depends on the return type. Assuming that the (optional) return type is only a single word,
Definitely
Flow extends JS and changes the regex. So it also inherits the
I think I did this because Excel only has built-in functions and
They are essentially just the names/indices of cells in a table. So I don't think
Don't worry about it. You win some, you lose some. Having a consistent standard is more important that some languages not looking their best in some themes. |
I see! I'm not sure what's a good one though, I think
I was close to offering to update the list, but I'm not sure now :P I was wondering if we could use a pattern instead, but looking at the snippets earlier, I highly doubt that it's possible.
I see! I think the function definition would be good enough, consistent with other languages. I presume you'll make a PR for the new regex?
Oh right, thanks for catching that! :) I'll make the PR for Excel and Flow shortly! |
Hmmm, maybe. I'll look into it. Since built-in commands/functions and user-defined procs use the same calling syntax, it will detect both, though. Edit: Yup, worth it. Mel got 90% lighter. #3393 |
Wow, that's amazing!!! I am once again impressed by your regex skills :D |
This is a tracking issue for the second half of #2849!
Long long list of languages ahead:
attr-name
toattribute
; Useattr-name
as alias #3381)class-name
standard token #3182)variable
and minor improvements #3186)char
token #3207)char
token #3188)char
token #3270)symbol
name #3195)property
forkey
; alias withattr-name
#3272, editorconfig: Change alias ofsection
fromkeyword
toselector
#3305)builtin
name #3198)quoted-atom
andatom
tosymbol
#3382)function-name
,range
,cell
#3391)type
toclass-name
#3390)tag
torecord
#3386)char
token and improvedstring
andnumber
tokens #3208)symbol
alias for filter names #3210)header
forsection
#3304)char
token #3217)char
token #3223)char
token and improved string interpolation #3225)key
toproperty
#3394)char
token and made some tokens greedy #3231)string
token #3235)key
,value
for token names,attr-...
as aliases #3377)boolean
token #3248)char
token #3252)type-definition
and use standard tokens correctly #3253)char
token #3254)char
token #3255)char
token #3256)operator
forpunctuation
#3306)regex
token #3257)char
token #3260)private
,view
keywords; Distinguishattribute
fromkeyword
#3389)char
token #3264)The text was updated successfully, but these errors were encountered: