Skip to content

Commit

Permalink
colorization support in pre-release (#3794)
Browse files Browse the repository at this point in the history
* colorization support in pre-release

* update changelog
  • Loading branch information
gcampbell-msft authored May 29, 2024
1 parent 9c7e643 commit a2642d3
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# What's New?

## 1.19

Features:

- Add support for CMake Language Support natively in this extension. [#3559](https://github.com/microsoft/vscode-cmake-tools/issues/3559)

## 1.18
Features:

Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Explore the [CMake Tools documentation](README.md)

## What about CMake language support?

CMake Tools was created separately from the [CMake extension](https://marketplace.visualstudio.com/items?itemName=twxs.cmake), which provides language coloring and autocompletion support.
We support CMake language support natively in the CMake Tools extension.

## How do I learn about CMake?

Expand Down
43 changes: 37 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
"tools",
"build",
"c++",
"native"
"native",
"syntaxes"
],
"engines": {
"vscode": "^1.63.0"
},
"categories": [
"Other",
"Debuggers"
"Debuggers",
"Programming Languages"
],
"galleryBanner": {
"color": "#13578c",
Expand Down Expand Up @@ -60,10 +62,30 @@
"workspaceContains:*/*/CMakeLists.txt",
"workspaceContains:*/*/*/CMakeLists.txt",
"workspaceContains:.vscode/cmake-kits.json",
"onFileSystem:cmake-tools-schema"
"onFileSystem:cmake-tools-schema",
"onLanguage:cmake"
],
"main": "./dist/main",
"contributes": {
"languages": [
{
"id": "cmake",
"extensions": [
".cmake"
],
"filenames": ["CMakeLists.txt"],
"aliases": [
"CMake"
]
},
{
"id": "cmake-cache",
"filenames": ["CMakeCache.txt"],
"aliases": [
"CMake Cache"
]
}
],
"commands": [
{
"command": "cmake.openCMakePresets",
Expand Down Expand Up @@ -828,6 +850,18 @@
"category": "CMake"
}
],
"grammars": [
{
"language": "cmake",
"scopeName": "source.cmake",
"path": "./syntaxes/CMake.tmLanguage"
},
{
"language": "cmake-cache",
"scopeName": "source.cmakecache",
"path": "./syntaxes/CMakeCache.tmLanguage"
}
],
"taskDefinitions": [
{
"type": "cmake",
Expand Down Expand Up @@ -3753,8 +3787,5 @@
"tsconfig-paths*/json5": "^1.0.2",
"minimatch": "^3.0.5"
},
"extensionPack": [
"twxs.cmake"
],
"packageManager": "[email protected]"
}
35 changes: 35 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2333,6 +2333,41 @@ export async function activate(context: vscode.ExtensionContext): Promise<api.CM
await vscode.window.showWarningMessage(localize('uninstall.old.cmaketools', 'Please uninstall any older versions of the CMake Tools extension. It is now published by Microsoft starting with version 1.2.0.'));
}

const CMAKE_LANGUAGE = "cmake";

vscode.languages.setLanguageConfiguration(CMAKE_LANGUAGE, {
indentationRules: {
// ^(.*\*/)?\s*\}.*$
decreaseIndentPattern: /^(.*\*\/)?\s*\}.*$/,
// ^.*\{[^}"']*$
increaseIndentPattern: /^.*\{[^}"']*$/
},
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: '#'
},
brackets: [
['{', '}'],
['(', ')']
],

__electricCharacterSupport: {
brackets: [
{ tokenType: 'delimiter.curly.ts', open: '{', close: '}', isElectric: true },
{ tokenType: 'delimiter.square.ts', open: '[', close: ']', isElectric: true },
{ tokenType: 'delimiter.paren.ts', open: '(', close: ')', isElectric: true }
]
},

__characterPairSupport: {
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '(', close: ')' },
{ open: '"', close: '"', notIn: ['string'] }
]
}
});

if (vscode.workspace.getConfiguration('cmake').get('showOptionsMovedNotification')) {
void vscode.window.showInformationMessage(
localize('options.moved.notification.body', "Some status bar options in CMake Tools have now moved to the Project Status View in the CMake Tools sidebar. You can customize your view with the 'cmake.options' property in settings."),
Expand Down

0 comments on commit a2642d3

Please sign in to comment.