-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimize semantic highlighting of ts and js
- Loading branch information
Showing
6 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Palette } from "../interface"; | ||
|
||
export function getColorfulSemantic(palette: Palette) { | ||
return { | ||
// JavaScript {{{ | ||
"variable.defaultLibrary:javascript": `${palette.purple}`, | ||
"property.defaultLibrary:javascript": `${palette.purple}`, | ||
// }}} | ||
// JavaScript React {{{ | ||
"variable.defaultLibrary:javascriptreact": `${palette.purple}`, | ||
"property.defaultLibrary:javascriptreact": `${palette.purple}`, | ||
// }}} | ||
// TypeScript {{{ | ||
"namespace:typescript": `${palette.purple}`, | ||
"enumMember:typescript": `${palette.yellow}`, | ||
"variable.defaultLibrary:typescript": `${palette.purple}`, | ||
"property.defaultLibrary:typescript": `${palette.purple}`, | ||
// }}} | ||
// TypeScript React {{{ | ||
"namespace:typescriptreact": `${palette.purple}`, | ||
"enumMember:typescriptreact": `${palette.yellow}`, | ||
"variable.defaultLibrary:typescriptreact": `${palette.purple}`, | ||
"property.defaultLibrary:typescriptreact": `${palette.purple}`, | ||
// }}} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Palette } from "../interface"; | ||
|
||
export function getDefaultSemantic(palette: Palette) { | ||
return { | ||
// JavaScript {{{ | ||
"variable.defaultLibrary:javascript": `${palette.purple}`, | ||
"property.defaultLibrary:javascript": `${palette.purple}`, | ||
// }}} | ||
// JavaScript React {{{ | ||
"variable.defaultLibrary:javascriptreact": `${palette.purple}`, | ||
"property.defaultLibrary:javascriptreact": `${palette.purple}`, | ||
// }}} | ||
// TypeScript {{{ | ||
"class:typescript": `${palette.aqua}`, | ||
"interface:typescript": `${palette.aqua}`, | ||
"enum:typescript": `${palette.purple}`, | ||
"enumMember:typescript": `${palette.blue}`, | ||
"namespace:typescript": `${palette.purple}`, | ||
"variable.defaultLibrary:typescript": `${palette.purple}`, | ||
"property.defaultLibrary:typescript": `${palette.purple}`, | ||
// }}} | ||
// TypeScript React {{{ | ||
"class:typescriptreact": `${palette.aqua}`, | ||
"interface:typescriptreact": `${palette.aqua}`, | ||
"enum:typescriptreact": `${palette.purple}`, | ||
"enumMember:typescriptreact": `${palette.blue}`, | ||
"namespace:typescriptreact": `${palette.purple}`, | ||
"variable.defaultLibrary:typescriptreact": `${palette.purple}`, | ||
"property.defaultLibrary:typescriptreact": `${palette.purple}`, | ||
// }}} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Configuration } from "../interface"; | ||
import { getPalette } from "../palette"; | ||
import { getDefaultSemantic } from "./default"; | ||
import { getColorfulSemantic } from "./colorful"; | ||
|
||
export function getSemantic(configuration: Configuration, variant: string) { | ||
let palette = getPalette(configuration, variant); | ||
let semantic: any; | ||
if (configuration.colorfulSyntax === false) { | ||
semantic = getDefaultSemantic(palette); | ||
} else { | ||
semantic = getColorfulSemantic(palette); | ||
} | ||
return semantic; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters