Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase 1 Partial - Colorization + share #3679

Merged
merged 13 commits into from
Apr 18, 2024
Merged
5,735 changes: 5,092 additions & 643 deletions NOTICE.txt

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions cgmanifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/component-detection-manifest.json",
"Registrations": [
{
"Component": {
"Type": "git",
"git": {
"repositoryUrl": "https://github.com/darthwalsh/vs.language.cmake",
"commitHash": "25a6749b2dd233233be0ab0ebb1d04d41cef6387"
}
}
},
{
"Component": {
"Type": "git",
"git": {
"repositoryUrl": "https://github.com/Kitware/CMake",
"commitHash": "5e984bb35232116a54de7db39788cb162ca7c263"
}
}
}
]
}
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
69 changes: 69 additions & 0 deletions jobs/languageSupport/sharedCode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This pipeline is designed to foster sharing our text mate grammars.

parameters:
- name: shareGrammars
type: boolean
default: false
values:
- true
- false
- name: shareQuickInfo
type: boolean
default: false
values:
- true
- false

resources:
repositories:
- repository: self
clean: true
- repository: VS-Platform
type: git
name: VS-Platform

# Every time we merge into main, we want to check for changes to code that is shared in other repos and that is synced other places.
trigger:
branches:
include:
- main
pr: none

pool:
name: "AzurePipelines-EO"
demands:
- ImageOverride -equals AzurePipelinesWindows2022compliant

name: $(Date:yyMMdd)$(Rev:rrr)

jobs:
- job: Copy_Code_Create_PRs
displayName: Copy shared code and create PRs if changes
condition: or(${{ parameters.shareGrammars }}, ${{ parameters.shareQuickInfo }})
steps:
- checkout: self
- checkout: VS-Platform
- task: UseNode@1
displayName: "Use Node 16.18"
inputs:
version: "16.18"
- script: npm install
displayName: "npm install"
workingDirectory: $(Build.SourcesDirectory)/vscode-cmake-tools/tools/pr-creator
- script: npm run build
displayName: "npm run build"
workingDirectory: $(Build.SourcesDirectory)/vscode-cmake-tools/tools/pr-creator
- script: node $(Build.SourcesDirectory)/vscode-cmake-tools/tools/pr-creator/dist/index.js --source-file-location $(grammarSourcePath) --target-repo $(grammarTargetRepo) --target-file-location $(grammarTargetPath)
displayName: Grammar - Copy files and Create PR
workingDirectory: $(Build.SourcesDirectory)/$(grammarTargetRepo)
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
condition: ${{ parameters.shareGrammars }}
- script: node $(Build.SourcesDirectory)/vscode-cmake-tools/tools/pr-creator/dist/index.js --source-file-location $(quickInfoSourcePath) --target-repo $(quickInfoTargetRepo) --target-file-location $(quickInfoTargetPath)
displayName: QuickInfo - Copy files and Create PR
workingDirectory: $(Build.SourcesDirectory)/$(quickInfoTargetRepo)
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
condition: ${{ parameters.shareQuickInfo }}


45 changes: 38 additions & 7 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 @@ -59,10 +61,30 @@
"workspaceContains:*/CMakeLists.txt",
"workspaceContains:*/*/CMakeLists.txt",
"workspaceContains:*/*/*/CMakeLists.txt",
"workspaceContains:.vscode/cmake-kits.json"
"workspaceContains:.vscode/cmake-kits.json",
"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 @@ -821,6 +843,18 @@
"icon": "$(play-circle)"
}
],
"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 @@ -3742,9 +3776,6 @@
"xml2js": "^0.5.0",
"tsconfig-paths*/json5": "^1.0.2",
"minimatch": "^3.0.5"
},
"extensionPack": [
"twxs.cmake"
],
},
"packageManager": "yarn@1.22.19"
}
35 changes: 35 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2311,6 +2311,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