[REQ] Themes select against CodeSense somehow
Posted: 19 January 2009 06:08 AM   [ Ignore ]
Sr. Member
RankRankRankRank
Total Posts:  232
Joined  2008-11-05

While we were working on the new sugar standards specs, we ran up against a problem: I was adamantly against providing a category for “builtin functions”. I was of the point of view that only keywords would be hardcoded into the syntax file, because unlike built-in functions, they were an actual part of the syntax of the language.

However, good points were brought up - it turns out that PHP programmers are used to having their built-in functions hilighted by their text editor. As it is, we can only apply CSS selectors that select Syntax elements as defined in Syntax.xml files. The problem is this leads to horrible zones, like this one extracted from the official JavaScript Sugar:

<zone name="support.function.js">
    <
expression>\b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\()</expression>
</
zone

Yes, downright ridiculous.

We realized after some discussion that we were *already* maintaining a list of all of the built-in/stdlib functions in our Sugars! CodeSense!

So, to solve this problem, the simplest solution is to allow Themers to hilight items of CodeSense.

Jan? Please? I can’t imagine that this would be too hard to implement, and it’d really allow us to keep our Syntax.xml files clear of this silliness without pissing off PHP and C programmers, who have hundreds if not thousands of built-in functions they need to be hilighted.

 Signature 

Ruby.sugar | Rails.sugar? | Haml.sugar | SASS.sugar | Sugar Manager.sugar | Git.sugar | Regex.sugar | ERb.sugar | RSpec.sugar

http://elliottcable.name/contact.xhtml

Profile
 
 
Posted: 19 January 2009 06:15 AM   [ Ignore ]   [ # 1 ]
Member
RankRankRank
Total Posts:  81
Joined  2008-10-28

I can see two ways of doing this:
a) Have some sort of variable that can be inserted into a regex containing an alternation, eg: /\b({$net.fileability.c.function-names})\b/ The regex would then be preprocessed by espresso.
b) Don’t use regexes at all, but allow some way to specify that a code sense library should have a syntax zone (faster but less powerful)

Profile
 
 
Posted: 19 January 2009 06:19 AM   [ Ignore ]   [ # 2 ]
Sr. Member
RankRankRankRank
Total Posts:  232
Joined  2008-11-05
alexgordon - 19 January 2009 06:15 AM

I can see two ways of doing this:
a) Have some sort of variable that can be inserted into a regex containing an alternation, eg: /\b({$net.fileability.c.function-names})\b/ The regex would then be preprocessed by espresso.
b) Don’t use regexes at all, but allow some way to specify that a code sense library should have a syntax zone (faster but less powerful)

I was hoping to have nothing to do with syntax zones at all - because they’re not, technically, the syntax of the language. Any more than x becomes a part of the syntax of the language when I type “x = 1”.

I want to see a specific selector for CodeSense in the themer’s toolkit - not see CodeSense imported into the Syntax.xml

But maybe that’s just me.

 Signature 

Ruby.sugar | Rails.sugar? | Haml.sugar | SASS.sugar | Sugar Manager.sugar | Git.sugar | Regex.sugar | ERb.sugar | RSpec.sugar

http://elliottcable.name/contact.xhtml

Profile
 
 
Posted: 19 January 2009 06:23 AM   [ Ignore ]   [ # 3 ]
Member
RankRankRank
Total Posts:  81
Joined  2008-10-28
elliottcable - 19 January 2009 06:19 AM
alexgordon - 19 January 2009 06:15 AM

I can see two ways of doing this:
a) Have some sort of variable that can be inserted into a regex containing an alternation, eg: /\b({$net.fileability.c.function-names})\b/ The regex would then be preprocessed by espresso.
b) Don’t use regexes at all, but allow some way to specify that a code sense library should have a syntax zone (faster but less powerful)

I was hoping to have nothing to do with syntax zones at all - because they’re not, technically, the syntax of the language. Any more than x becomes a part of the syntax of the language when I type “x = 1”.

I want to see a specific selector for CodeSense in the themer’s toolkit - not see CodeSense imported into the Syntax.xml

But maybe that’s just me.

I completely disagree. Code sense should go in the syntax. To the themer, there should be no noticeable difference between regex provided zones and code sense provided zones.

Profile
 
 
Posted: 19 January 2009 06:43 AM   [ Ignore ]   [ # 4 ]
Sr. Member
RankRankRankRank
Total Posts:  232
Joined  2008-11-05
alexgordon - 19 January 2009 06:23 AM
I completely disagree. Code sense should go in the syntax.

But… it’s not syntax. That’s simply not semantic. And non-semanticity is the devil.

alexgordon - 19 January 2009 06:23 AM
To the themer, there should be no noticeable difference between regex provided zones and code sense provided zones.

Then do that on the Espresso end, so that Syntax and CodeSense “goes in”, and then (from the themers point of view), one accessor system “comes out”. Details up to Jan, I don’t really have any good ideas.

But I don’t want to have to put anything in my Syntax.xml at all that doesn’t actually refer to a real element of syntax - including lines that simply refer to CodeSense data.

 Signature 

Ruby.sugar | Rails.sugar? | Haml.sugar | SASS.sugar | Sugar Manager.sugar | Git.sugar | Regex.sugar | ERb.sugar | RSpec.sugar

http://elliottcable.name/contact.xhtml

Profile
 
 
Posted: 19 January 2009 06:47 AM   [ Ignore ]   [ # 5 ]
Member
RankRankRank
Total Posts:  81
Joined  2008-10-28
elliottcable - 19 January 2009 06:43 AM
alexgordon - 19 January 2009 06:23 AM
I completely disagree. Code sense should go in the syntax.

But… it’s not syntax. That’s simply not semantic. And non-semanticity is the devil.

alexgordon - 19 January 2009 06:23 AM
To the themer, there should be no noticeable difference between regex provided zones and code sense provided zones.

Then do that on the Espresso end, so that Syntax and CodeSense “goes in”, and then (from the themers point of view), one accessor system “comes out”. Details up to Jan, I don’t really have any good ideas.

But I don’t want to have to put anything in my Syntax.xml at all that doesn’t actually refer to a real element of syntax - including lines that simply refer to CodeSense data.

It does refer to a real element of syntax. If I had a list of keywords in a code sense library, the same list as in my syntax.xml now, I could get rid of the <expression> in the keyword zone, and replace it with something that gets data from code sense. That doesn’t change the keywords’ “real element of syntax” status.

Profile
 
 
Posted: 19 January 2009 06:52 AM   [ Ignore ]   [ # 6 ]
Sr. Member
RankRankRankRank
Total Posts:  232
Joined  2008-11-05

Oh, I understand, for keywords, sure.

I was talking about for functions, which was my main worry. I hadn’t even considered keywords - in the languages causing the problem here (C, PHP) there are far more built-in functions and standard library functions than there are actual keywords that should be in the syntax definition.

 Signature 

Ruby.sugar | Rails.sugar? | Haml.sugar | SASS.sugar | Sugar Manager.sugar | Git.sugar | Regex.sugar | ERb.sugar | RSpec.sugar

http://elliottcable.name/contact.xhtml

Profile
 
 
Posted: 19 January 2009 11:23 AM   [ Ignore ]   [ # 7 ]
Member
RankRankRank
Total Posts:  81
Joined  2008-10-28
elliottcable - 19 January 2009 06:52 AM

Oh, I understand, for keywords, sure.

I was talking about for functions, which was my main worry. I hadn’t even considered keywords - in the languages causing the problem here (C, PHP) there are far more built-in functions and standard library functions than there are actual keywords that should be in the syntax definition.

Well, this is a list of types I have in my C sugar:

int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void 

It’s pretty ridiculous. If they were in a code sense library, it would be much more manageable. I suppose my point is, functions aren’t the only thing which this could be used for.

Profile
 
 
Posted: 21 January 2009 08:06 AM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  12
Joined  2008-12-17

This is a must!

I think maybe having something like this within zones: <codesense>function.builtin</codesense>, to replace <expression> when necessary would be the way to go. It would look for the appropriate list in the code sense file.

Profile