Skip to content

Commit

Permalink
Phase 1 Partial - Colorization + share (#3679)
Browse files Browse the repository at this point in the history
* add syntax files, add languages, grammars, to package.json

copy over stuff to play with later

got the grammars working with the other stuff commented out

cleaned up, not tested

remove stuff

I don't think we really need to have a unique ID, we should tell people to only install our extension

remove unnecessary method

update our syntaxes from what we do in VS

test pipeline

update cgmanifest

temporarly force cg

test different version

use .3 version

update notice, it includes textmate reference

manually add kitware/cmake reference to NOTICE

fix trigger

fix pipeline name

get repo

make sure we checkout the repos

powershell

inline

reference variables correctly

testing for differences, CHANGE LATER

updating textmate

see if we're getting the right git diff

test with explicit path

update dates

write output

try to properly access variables

use embeddedbot

put emails and username in variables

switch when I update config

orgurl

add logging

update auth

update docs

testing out PR tool

remove 'description' option

add console.log statements for testing

map system token

run index.ts for both grammars and quickinfo, put paths into variables, condition based on parameters

fix trigger

access variables correctly

access variables correctly

only run job if one of the share steps is enabled

fix job name

test without prefix

remove difference

remove snippets keyword until we actually add this

remove stray miscopy

remove powershell

* small update

* ignore tools directory when packaging

* don't build the tools directory when building and testing the extension

* exclude tools for webpack?

* revert webpack

* try webpack fix again

* try another fix

* revert

* we need to remote the NOTICE for testing earlier so yarn doesn't fail

* rename notices.txt to get around yarn issue

* update changelog
  • Loading branch information
gcampbell-msft committed Apr 18, 2024
1 parent 31de14d commit 25698e0
Show file tree
Hide file tree
Showing 19 changed files with 7,609 additions and 2,181 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci-main-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
configure-options: -DCMAKE_INSTALL_PREFIX:STRING=${{ github.workspace }}/test/fakebin
install-build: true

- name: Delete NOTICE.txt
run: rm ${{ github.workspace }}/NOTICE.txt

- name: Run backend tests
run: yarn backendTests

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci-main-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
configure-options: -DCMAKE_INSTALL_PREFIX:STRING=${{ github.workspace }}/test/fakebin
install-build: true

- name: Delete NOTICE.txt
run: rm ${{ github.workspace }}/NOTICE.txt


- name: Run successful-build test
run: yarn extensionTestsSuccessfulBuild
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ci-main.win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ jobs:
configure-options: -DCMAKE_INSTALL_PREFIX:STRING=${{ github.workspace }}/test/fakebin
install-build: true

- name: Delete NOTICE.txt
run: del ${{ github.workspace }}/NOTICE.txt

- name: Run backend tests
run: yarn backendTests

Expand Down
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ out/
scripts/
src/
test/
tools/
vscode-extensions-localization-export/
vscode-translations-import/
**/*.map
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Features:

- Add the possibility to open the current build directory in the Explorer [#1451](https://github.com/microsoft/vscode-cmake-tools/issues/1451)
- Add support for CMakePresets V7 and V8. [#3549](https://github.com/microsoft/vscode-cmake-tools/issues/3549)
- Add support for CMake Language Support natively in this extension. [#3559](https://github.com/microsoft/vscode-cmake-tools/issues/3559)

Improvements:

Expand Down
2,165 changes: 0 additions & 2,165 deletions NOTICE.txt

This file was deleted.

6,614 changes: 6,614 additions & 0 deletions ThirdPartyNotices.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 @@ -827,6 +849,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 @@ -3748,9 +3782,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 @@ -2324,6 +2324,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 25698e0

Please sign in to comment.