Closed REYNEP closed 3 years ago
I am going to work now, I will deal with it after getting off work.
Can I understand "unit8_t, unit32_t" as a data type? Then give them pink?
Please copy the first code here, I want to see why the equal sign is blue.
Uhhh.... You can think of them as data types, those are defined in the Standard C Library, and thus also Standard C++ Library also has those. You can give them pink in that sense, but also I just wanted to say the Violet color could be used more often
The first one:-
bool *flagsSurfaceExtsPtr = reinterpret_cast<bool *> (&(flagsSurfaceExts));
for (uint8_t i = 0; i < xd_size; i++) {
for (uint8_t j = 0; j < iec; j++) {
if (strcmp(iep[j].extensionName, xd[i]) == 0) {
*(flagsSurfaceExtsPtr + i) = true;
tmp_surface_ep[i] = iep[j]; //tmp_surface_ep will be also sorted as T_flagsSurfaceExts
}
}
}
The Second One:-
uint32_t *amVK::mark_PhysicalDevs() {
uint32_t *pd_marked = static_cast<uint32_t *> (calloc(pdc, 4));
for (uint8_t i = 0; i < pdc; i++) {
pd_marked[i] = 0;
}
for (uint8_t i = 0; i < pdc; i++) {
if (pdp[i].deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) {
pd_marked[i] += 1;
}
}
return pd_marked;
}
Sorry for late reply....
๐, I can see you changed uint8_t, uint32_t, storage.type.built-in
back to Violet
Thank you for the quick patch....
Hi, @REYNEP
In fact, I'm just a junior front-end programmer, I don't understand the syntax of Cpp, the sample codes I used to set the color are all pasted from the Internet. If the editor reports no errors when pasted, I think this code is syntactically correct and can color the code according to its semantics. The reason why I wanted to set 'uint8_t, uint32_t' to pink since I saw such a piece of code.
#include<iostream>
#include<string>
#include <limits>
using namespace std;
int main()
{
cout << "\tMax:" << (numeric_limits<long double>::max)();
cout << "\tMin:" << (numeric_limits<long double>::min)() << endl;
cout << "float: \t\t" << "characters" << sizeof(float);
cout << "\tMax:" << (numeric_limits<float>::max)();
cout << "\tMin:" << (numeric_limits<float>::min)() << endl;
cout << "size_t: \t" << "characters" << sizeof(size_t a);
cout << "\tMax:" << (numeric_limits<uint32_t>::max)();
cout << "\tMin:" << (numeric_limits<uint8_t>::min)() << endl;
cout << "string: \t" << "characters" << sizeof(uint8_t) << endl;
return 0;
}
//Below is your code.
uint32_t *amVK::mark_PhysicalDevs() {
uint32_t *pd_marked = static_cast<uint32_t *> (calloc(pdc, 4));
for (uint8_t i = 0; i < pdc; i++) {
pd_marked[i] = 0;
}
for (uint8_t i = 0; i < pdc; i++) {
if (pdp[i].deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) {
pd_marked[i] += 1;
}
}
return pd_marked;
}
Now I have two questions:๏ผIf there is any syntax error in this code, please point it out first๏ผ
1, I think 'size_t,uint8_t, uint32_t' in lines 13~16 should be set into pink. How about you ?
2, What color do you think โnumeric_limits, static_castโ should be set to ๏ผ
1.0. Well, yeah, those should be pink, Syntactically thinking, cause those comes predefined in the Standard Library. But Those are not like FUNDAMENTAL. cause typedef unsigned long int uint64_t
and typedef unsigned int uint8_t
๐ค is how those are defined
- Also about `char32_t`, you might wanna give them the same color as `uint32_t` cz... those are also predefined in the Standard Library. But not exactly fully [Needed] FUNDAMENTAL types. Currently `char32_t, char16_t` **[support.type.built-in.posix-reserved.cpp** also **support.type.posix-reserved.cpp]** don't have any color.
```cpp
char *string; //a.k.a pointer to first letter of a word
int y; //range [-2147483648 to 2147483648]
uint32_t *x = 0xFFFFFFFF; //unsigned [range: 0 to 4294967295] cz 4Byte long
char32_t *utf32_string; //I really did not know that github had Different colors for types like uint32_t, char32_t ๐
uint8_t z; //really short string, only 1 Byte [range: 0 to 255]
```
**2.0** I don't think `numeric_limits` should get the same color as `static_cast, reinterpret_cast, const_cast, dynamic_cast` [ `keyword.operator.cast` ] bcz casting is entirely different than numeric_limits, even tho the syntax is the same....
`numeric_limits` is a Class like in other languages, But
`static_cast` is a (SAFER) type conversion syntax
AT COMPILE-TIME, the compiler will then create 2 Different classes in binary, one for `int`, one for `float`....
In one, It will replace **T** with **int**
In another one. it will replace **T** with **float** (and then convert both of those to Binary Obviously)
(you can think of **T** more like a Parameter, except this is getting changed at Compile Time, like Preprocessor Functions)
NOTE THAT, in the example above, only `int` and `float` was used.... SO after compilation when running some program, no one can create a `char` array or `string` array per se....
> Also, TEMPLATE is really broader than this. instead of Using template for a CLASS _**[eg. we used TEMPLATE for S_amVK_array CLASS],**_ you can use Template for **STRUCTS & FUNCTIONS** too. Also instead of just DATA TYPES **[typename T]** as parameter of Template, you can use **class VAR_NAME** as parameter too. Its really broad and can get completely messy really soon.... It's like you can even say this `S_amVK_array
Now about `static_cast`, static cast is more a Syntactic sugar for SAFER type conversion usually
```cpp
float y = 1.21f;
int x = (int) y; //The way C does it. [Modern CPP users tend to hate this, but algorithmists tend to use this]
int z = static_cast
Update: Added the Code, and changed the 2nd Paragraph about char32_t
Hi! @REYNEP,
Sorry for reply late.
Thanks so much for you taking hours to write down this detailed reply to explain these syntax concepts of C++ to me.
I spent hours reading through and understanding your reply, then I updated Eva Theme 1.5.1, you can see following changes:
1, All "uint8_t,char32_t" are set into Pink. "char32_t" is missed, it will been set in 1.5.2.
I know Violet is used rarely...But keep semantic is a higher priority. As the keyword color of creating or defining functions and variables, Violet appears frequently in other languages. I think the reason why Violet is rarely used in C/C + + is due to the syntax of C / C++.
For example, in TS, defining variables and adding type information to variables are two actions, which are completed in two words.
while in C/C++:
When two actions are completed by one word, in order to emphasize type information, Pink is used instead of Violet.
2, keywords "public, static, privite" are set into Violet. As long as the keyword's meaning is close to the creation or definition, I use Violet.
3, I tried to set "static_cast" into Violet, but the code doesn't read well. The action of type conversion makes me feel more like executed a function. So it will be changed to Blue in 1.5.2.
4, Initially, I wanted to distinguish between user-defined functions(Blue) and language built-in functions(Aquamarine), however, it can't be realized in many languages. So I unified all function names into Blue. Then, except HTML and CSS, Aquamarine has become the least frequent color in other languages, only used as the color of operational symbols.
After the first modification, Pink appears too much in C/C++, so the color of Class and Struct name are changed from Pink to Aquamarine. It's a new attempt.
There may be a few hours' time difference between us. On weekdays, I usually update Eva Theme and deal with Eva Theme's issues after 10 pm. GitHub is not a real-time chat tool, so I usually come back to see issues' replies the next night. Replies within one day are all very timely.
Sorry, it took you hours to understand. I thought keeping it short and simple would be just easy and faster. But still you had to work Hours just for Understanding.... Really Sorry ๐๐
But, After the update this happened:-
When C\C++ extension is enabled uint32_t, uin8_t, char32_t
are Aquamarine [Gets overwritten by entity.name.type
]
& because of entity.name.type
, CUSTOM data types look Aquamarine too..... maybe You could give CUSTOM Data types, VIOLET cz after 1.5.1 update, Violet became Rarer than before [Checked some Blender Files]
[variable names are RED, cause those are CLASS Members]
[Also, Official VSCode theme does give CUSTOM data types a different color]
The why I am telling saying VIOLET is because of this, [I DO Love AQUAMARINE too!]
Here, amVK, a Class is Aquamarine too
We're Implementing CreateDevice func here, That was Declared in a Header file....
I think static_cast and other casting color was Perfect as Aquamarine as Data types are PINK (or CUSTOM data types are WHITE without C/C++ Ext)
MOST of the times this is how CASTING is done by ppl, Before calling a function ๐
with a CALLOC or MALLOC func call
NOTE: The picture above [3rd One] is without C/C++ Ext
[About C++ syntax, I think it could be better if we talked over DISCORD or smth like that, I mean there are Lot of stuffs that could be discussed. REYNEP#2500, Or if you wanna talk over some other platform, feel free to tell me]
Hey, @fisheva I'm sorry, that you had to go through the comment for Hours. I should have told you to read about Preprocessors First.
Anyway, about Preprocessors, You could watch this https://www.youtube.com/watch?v=j3mYki1SrKE
Also I actually was introduced to templates by his Template Intro: https://www.youtube.com/watch?v=I-hZkUa9mIs [But I really feel like I Failed to surve the purpose of passing on the Knowledge]
I Think this could also Help, cz this is only 1 Page:- https://cs50.harvard.edu/ap/2020/assets/pdfs/compiling.pdf
But I still feel like, it would be better if I could do something like Stream in Discord & talk๐
@fisheva, once again REYNEP#2500 is my Discord [if you use that]. But won't have any problems with smth else like DISCORD....
๐, I spent hours reading and uderstanding your reply, it's because I need some translation, and I haven't learned or used complex programming languages like C++ before. It's not your fault, you did very well ! Thanks~
Please post these three pieces of code above. Let me test them on my computer.
This may be the reason, on Eva Theme README.md:
Class, Interface, Struct are all Aquamarine now, so I don't want to set casting color Aquamarine too.
Discord is not accessible in China. And my English listening and speaking is not good, if we talk on live chat software, you might feel bad ๐. I think Github is good enough ๐.
Well, those type definitions are from Vulkan Library, SO i am gonna make some Custom Data Types with struct
typedef struct vec3d {
float x;
float y;
float z;
} vec3d;
typedef class object3d {
char *name;
vec3d pos;
vec3d[8] bounding_box;
vec3d *get_pos();
} object3d;
object3d *all_objects_in_scene = nullptr;
vec3d world_center = {0, 0, 0};
//The Second Image
vec3d *object3d::get_pos() {
return &pos; //returning the pointer
}
And lot of errors will be detected... by C/C++ ext, on the third image's code [+ You might not see the colors like I do on my PC, cz the Header files are not there, SO I made a Repo, and Invited you, Uploaded needed Vulkan Header files too]
bool amVK::enum_PhysicalDevs() {
if (pdl == nullptr) {
vkEnumeratePhysicalDevices(instance, &pdc, nullptr);
if (pdc == 0) {
LOG_DEV("Vulkan Loader failed to find GPUs with Vulkan support!");
return false;
} else if (pdc > 1000) {
LOG_DEV("MORE THAN A THOUSAND GPUs? Are you REALLY SURE?");
}
pdl = static_cast<VkPhysicalDevice *> (calloc(pdc, sizeof(VkPhysicalDevice)));
vkEnumeratePhysicalDevices(instance, &pdc, pdl);
pdp = static_cast<VkPhysicalDeviceProperties *> (calloc(pdc, sizeof(VkPhysicalDeviceProperties)));
for (uint32_t i = 0; i < pdc; i++) {
vkGetPhysicalDeviceProperties(*(pdl), (pdp+i));
}
amLOG("PhysicalDevice Properties loaded:- ");
}
LOG("All the Physical Devices:- ");
for (uint8_t i = 0; i < pdc; i++) {
LOG(pdp[i].deviceName << " [PhysicalDevice Name]");
}
LOG("\n");
return true;
}
Enhanced Colorization sometimes makes life easier.... And I don't think it removes any scope from any Word in code.... It only adds more, and yes there have been many bugs and mismatches, but nowadays only a few of those exists... If you give me the permission I could try patching and making a pull request....
We can't affect the effect of Enhanced Colorization on the theme file๏ผit's overlaid on the theme, right?
Of course, you can make pull requests.
That extension does a Pretty bad thing. It adds entity.type.name
but doesn't add .cpp
in the end -_-
No, it's me added entity.type.name
in 1.5.2. Because in many languages the scope value of Class is that, so I didn't add the suffix.
No, no... C/C++ Extension adds custom Scopes, When you ENABLE C_Cpp.enhancedColorization, most of the Words in Code gets new scopes. And You can't overwrite those with the Vanilla [without extension] textmate scopes.... So what happens is these are the scopes that they add, but doesn't add .cpp
in the end of any of the scopes....
Without .cpp
, changing some color would globally change All language colors, [The only way out would be to manually overwrite Other Languages]
Also.... And The amount of change you have made, if it affects other languages too, because of the Previous c++ patches you have made. in the last few days. That makes me wonder what will other users of evaTheme think after they see lots of changes in colors
I mean, I just checked out a .ts file, and it feels like lots of Colors was changed in the last 2 weeks, If you are only doing this many changes for C/C++ support, I want you to remember that, People loved EvaTheme as it was, And I [or anyone else] wouldn't want you to prioritize C/C++ [or a specific language] over other languages
That's why I added this notice in the README.
Yeah, Now I understand. I thought they added .cpp
, but they don't
But yes, I do think that, after the changes, That TS file looks way better in 1.5.3 than in 1.3.x
There are indeed many changes in Eva Theme these days. For example, the color of the Class/Interface changes from Pink to Aquamarine, which is a big change.
It just, I think these changes make Eva Theme more semantic.
Other Languages like JS, Python also looks Better too in 1.5.3, I think.... ๐
Nice talk this afternoon, I'm going out for dinner, see you, wish you happiness everyday! : D
Wish U lots and lots and lots and lots and lots of felicity, ecstasy, joy & adventure too....
One last thing, Could you make keyword.operator.cast
VIOLET & italic? Currently static_cast, reinterpret_cast etc
clashes with the Function calls ๐
See 2 days ago commented above. It's 1:40 am here now, I have to go to bed.
But that static_cast, reinterpret_cast
are something like Functions.... Type Casting are more like inline, const, typedef
- Something maintained by the Compiler itself
Type Casting being Blue can cause Confusions sometimes, and New programmers might find it even more difficult to understand, E.G. This:-
mergeSort is a Function here which is templated. The TYPE in Angle-bracket specifies type of data That we're gonna sort
When Violet, this would have looked like this,
+I think violet could give it a Syntactic meaning. Cz all other stuffs that are maintained by the compiler is already violet
pd_sortedByMark = static_cast<uint32_t *> (calloc(pdc, sizeof(uint32_t)));
memcpy(pd_sortedByMark, pd_benchMarks, pdc*sizeof(uint32_t));
sort_success = mergeSort<uint32_t> (0, pdc-1, pd_sortedByMark);
It's your choice. I love EvaTheme, it was always your choices that made evaTheme look this much Amazing. its just that, I am saying all the stuffs cz I love the Violet and just wished to see that more often....
Where I live is GMT+6 ๐ธ
"inline, const" are storage.modifier.specifier
, while "static_cast" is keyword.operator.cast
.
Although keyword.operator.cast
are operators instead of functions in syntax, they are written like a function and behave like a function (complete an action), so I think coloring them Blue is helpful for users to read the code.
Unlike other semantics(which both have their own specific color), I color operators according to their return results and behaviors.
For example:
"sizeof()" is also colored Blue; "instanceof" is colored Purple since it returns boolean; "typeof" is colored Pink since it returns data types(A bit tangled, I thought about coloring it Blue too).
Can you explain the meaning of "static_cast" from the perspective of "creation" or "definition"? Only then can I give it Violet. It feels too much like a function to me now.
There is a 6 hour time difference between us.
https://github.com/microsoft/vscode-cpptools/issues/7773
HI... How you doin'?
[they added this to 1.6.0]
Can you tell me what happened to that issue in a short language?...
Oh, Sorry, I forgot to add details.... It's about that Enhanced Colorization Conflicts
.cpp
or .c
wasn't added earlier by C/C++ extension. So reported an Issue, They made a Fix, That's gonna be there from the Next build of the extension
[But, there are a lot of Stuff that needs to be fixed for C/C++ Extension still yet]
Sorry for late.
It's really good news for programmers who write c++ with other languages.
Hey, How are you doing? ๐
I haven't replied in a While, I've been writing Some actual code For the past few days.... again after Months of Idleness and Negligence.... Feels really good to be back at it again
Sounds like your job is leisurely, admirable! I only have 2 or 3 hours of free time every day, minus the time spent with my friends & family, I don't have much time to update Eva Theme. Fortunately, EVA theme has entered a relatively perfect and stable stage.
Well, I am seventeen.... just another kid in High School, Fantasizing, Exploring, trying out New stuffs.... ๐ฒ๐๐ฒ
Wow! You have learned C++ so well at 17 years old. Amazing and admirable!
By the way, I find another very good-looking theme, Nebula.
@fisheva ..... Hey Thanks.... How are you?
I found a font that you might like.... It's Called 'Fira' [https://github.com/mozilla/Fira/tree/master/ttf] Try out the 'Fira Mono Medium' in VS-CODE with font size 15/16, you'll like it ๐ [Let me know even if you don't]
[P.S. the font is from POP-OS (linux)]
Thanks, I tried 'Fira Mono', both Regular & Medium. I'm not used to it. My programming font is CamingoCode. Maybe you can have a try on it.
๐Mine Looks Like this.... ๐
Your Mono One, seems Cool, I will have that as Secondary, Since I like to frequently switch between two fonts, Thanks for sharing yours...
IDK why, but for some reason Fira seems Smoother.... [And I fell in love with the Smooth style of it]
@fisheva How you doin'???
Busy work every day...
@fisheva i never really used visual studio.... dont actually like that.... but if i ever do install or use that will definitely use Eva Theme!!!! ๐
@fisheva I finally found a way to, change C/C++ Extension stuffs....๐ (Gonna.... bring back Scopes that that extension overrides ๐ง๐ฒ)
How you doin' nowadays...?
@REYNEP Wow, how to do that? Overrides again in VSCode settings.json?
I was watching Dota2 TI Championships these days. Itโs over now.
nah, for colorization VSCode has TextMate Scopes & Semantic Tokenization C/C++ Extension switched to SemanticTokens last year Q2
And i still can't find a way to override Tokens that they provide.... [after a day]
btw, what games do you play tho
About Semantic Tokens, you can have a look at issue #54.
I usually play Dota2 OMG mode, World of Warcraft(not now).
@fisheva how you doin'?
@REYNEP Hi, Long time no see~
About Semantic Tokens, I raised an issue on vscode-extension-samples #551. But no one has answered me yet, I am wondering if the repository where I raised the issue is wrong (:ะทใโ )
So Violet - [#A78CFA, that color of NOTE] is used really rarely in EvaTheme.... ๐![image](https://user-images.githubusercontent.com/35212190/123562181-d31c1580-d7ce-11eb-8c2f-9fe9355468f9.png)
But I think Violet actually looks cute along with other main colors like the Blue & the Pink
[int, bool, float in the pictures]
and the Purple[for, return, nullptr in the pictures]
that EvaTheme usages..... ๐๐In C and C++, Violet is hardly ever used, [currently EvaTheme has these ones colored Violet]:-
storage.modifier.specifier.static
was changedfor c++ in 1.4.5
]storage.modifier
was changedfor c++ in 1.4.5
update yesterday]All of these [except for 5th point], most of the times basically ends up in the HEADER file, you could see violet there with a feeling of it being uncommon. I do think this color should be uncommon like that. But in a CPP code file. You can hardly ever see Violet, and it feels like a
**Legendary Item**
in terms of games ๐------------------------ What actually caught my eye. ๐ค [I think the Orange is a Bit too much CONTRASTY] -------------------------
> I mean Contrasty as in, its used often along with Pink, Blue and the Purple color.... but too much of That Orange really starts catching your eye. But the Violet doesn't, it Can Blend in with others in an Amazing way I think.... ๐ > And uhhh, recently in 1.4.5 update, `storage.type.built-in.cpp` was Added. Before that `storage.type` was always Violet Because of which data types like **uint32_t, int8_t** got changed to a Orange looking color. Here are Some Before, Afters of 1.4.5 ![image](https://user-images.githubusercontent.com/35212190/123562706-4410fc80-d7d2-11eb-96c5-c4db1af80f94.png) **BEFORE-:** ![image](https://user-images.githubusercontent.com/35212190/123562893-4e7fc600-d7d3-11eb-93b7-555418242c8a.png) ![image](https://user-images.githubusercontent.com/35212190/123562839-fea0ff00-d7d2-11eb-9b8c-1d6fbd2b711f.png) **BEFORE-:** ![image](https://user-images.githubusercontent.com/35212190/123562932-838c1880-d7d3-11eb-85ba-c329fcd06eb0.png)