Skip to content

Commit 79a6711

Browse files
committed
main
1 parent 8c639c2 commit 79a6711

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

docs/.vitepress/config.mts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ const vitepressConfig = defineConfig({
1717
markdown: {
1818
lineNumbers: true,
1919
theme: {
20-
// light: await themeService.getTheme('Eva Light'),
20+
light: await themeService.getTheme('Eva Light'),
2121
// dark: await themeService.getTheme('Eva Dark'),
22-
light: 'light-plus',
23-
dark: 'dark-plus',
22+
dark: await themeService.getTheme('JetBrains Rider Dark Theme'),
2423
},
2524
codeTransformers: [transformerTwoslash()],
2625
},

docs/document/Modern CSharp/docs/Understanding Bit Operation.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ Console.WriteLine($"{nameof(after),6}: {after:B}");
9797
- bitwise AND `&`: returns `1` for each bit as long as all of the two is `1`, else `0`
9898
- bitwise XOR `^`: returns `1` if the two bits are different, `0` when identical
9999

100-
101100
## Bitwise on Enum
102101

103102
Enum can be flags when the type is marked with `FlagsAttribute` and ordinary enum members are powers of 2(members represent the `All` or `None` are exceptional)
@@ -131,7 +130,7 @@ enum Foo
131130
Bit mask is a common pattern that works like a filter to include or exclude or test bits.
132131
The mask can refer to a integer represented as binary, a sequence of integers or a matrix of integers. The classical usage is a singular number.
133132

134-
### Is Bit Set
133+
## Bit Checking
135134

136135
A common usage of mask is checking whether certain bit **is set**
137136

@@ -152,8 +151,10 @@ int mask = 1 << position; // generate a special number 0100
152151
bool positionIsSet = (number & mask) != 0;
153152
```
154153

155-
This is the particular same case as how we tell whether a union of enum contains a enum flag.
154+
This is the particularly similar as how we tell whether a union of enum contains a enum flag.
155+
156156
Since each enum member has **only one bit set**, the union in the following example has two bits set, only when the set bit from the flag being checked overlaps with any bit of the union can it evaluate to non-zero.
157+
157158
And in fact the operation `(union & flag)` should be equal to the flag itself.
158159

159160
> [!WARNING]
@@ -177,3 +178,11 @@ enum Foo
177178
All = ~(~0 << 4)
178179
}
179180
```
181+
182+
## Set & Unset & Toggle
183+
184+
Similar to checking a bit, setting and unsetting require a same mask but different operation.
185+
186+
- set a bit: `number | (1 << position)`
187+
- unset a bit: `number & ~(1 << position)`
188+
- toggle a bit: `number ^ (1 << position)`

docs/services/ThemeService.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ const themeInfos = {
3131
path: 'VSCode/themes/Eva-Dark.json',
3232
branch: 'master',
3333
},
34+
'JetBrains Rider Dark Theme': {
35+
repo: 'edsulaiman/jetbrains-rider-dark-theme',
36+
path: 'themes/JetBrains Rider Dark Theme-color-theme.json',
37+
branch: 'main',
38+
},
3439
} satisfies Record<string, RemoteThemeInfo>;
3540

3641
export type ThemeName = keyof typeof themeInfos;
@@ -44,7 +49,7 @@ class ThemeService implements IThemeService {
4449
const foo = theme.tokenColors.filter(x => x.scope.startsWith('comment'))[0];
4550
foo.settings.fontStyle = '';
4651
}
47-
this.innerThemeService.loadTheme(theme);
52+
await this.innerThemeService.loadTheme(theme);
4853
}
4954
async getTheme(name: ThemeName): Promise<shiki.ThemeRegistration> {
5055
if (!this.isThemeRegistered(name)) throw new Error(`Theme \`${name}\` not registered.`);

0 commit comments

Comments
 (0)