Skip to content

Commit

Permalink
enabling of individual languages with ```clang-format.language.javasc…
Browse files Browse the repository at this point in the history
…ript.enable```, etc.
  • Loading branch information
xaverh committed Jul 8, 2016
1 parent a9b149a commit 76ee630
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ test/**
src/**
**/*.map
.gitignore
tsconfig.json
tsconfig.json
clang-format.xcf
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Release history

### v 0.10.0
* enabling of individual languages with ```clang-format.language.javascript.enable```, etc.

### v 0.9.0
* add protobuf support (work with https://marketplace.visualstudio.com/items?itemName=peterj.proto)
* add javascript/typescript support
Expand Down
80 changes: 64 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "clang-format",
"displayName": "Clang-Format",
"description": "Use Clang-Format in Visual Studio Code",
"version": "0.9.0",
"version": "0.10.0",
"publisher": "xaver",
"engines": {
"vscode": "^1.0.0"
Expand All @@ -11,7 +11,20 @@
"sax": "^1.1.5"
},
"categories": [
"Other"
"Other",
"Languages"
],
"keywords": [
"Tools",
"C++",
"C",
"JavaScript",
"Protobuf",
"Java",
"Objective-C",
"Clang",
"LLVM",
"Clang-Format"
],
"main": "./out/src/extension",
"activationEvents": [
Expand Down Expand Up @@ -48,75 +61,110 @@
"default": "LLVM",
"description": "clang-format fallback style.(-fallback-style=value, value can be none, LLVM, Google, Chromium, Mozilla, WebKit)"
},
"clang-format.language.cpp.enable": {
"type": "boolean",
"default": true,
"description": "enable formatting for C++"
},
"clang-format.language.cpp.style": {
"type": "string",
"default": "",
"description": "clang-format fallback style for c++, left empty to use clang-format.style"
"description": "clang-format fallback style for C++, left empty to use clang-format.style"
},
"clang-format.language.cpp.fallbackStyle": {
"type": "string",
"default": "",
"description": "clang-format fallback style for c++, left empty to use clang-format.fallbackStyle"
"description": "clang-format fallback style for C++, left empty to use clang-format.fallbackStyle"
},
"clang-format.language.c.enable": {
"type": "boolean",
"default": true,
"description": "enable formatting for C"
},
"clang-format.language.c.style": {
"type": "string",
"default": "",
"description": "clang-format fallback style for c, left empty to use clang-format.style"
"description": "clang-format fallback style for C, left empty to use clang-format.style"
},
"clang-format.language.c.fallbackStyle": {
"type": "string",
"default": "",
"description": "clang-format fallback style for c, left empty to use clang-format.fallbackStyle"
"description": "clang-format fallback style for C, left empty to use clang-format.fallbackStyle"
},
"clang-format.language.objective-c.enable": {
"type": "boolean",
"default": true,
"description": "enable formatting for Objective-C"
},
"clang-format.language.objective-c.style": {
"type": "string",
"default": "",
"description": "clang-format fallback style for objective-c, left empty to use clang-format.style"
"description": "clang-format fallback style for Objective-C, left empty to use clang-format.style"
},
"clang-format.language.objective-c.fallbackStyle": {
"type": "string",
"default": "",
"description": "clang-format fallback style for objective-c, left empty to use clang-format.fallbackStyle"
"description": "clang-format fallback style for Objective-C, left empty to use clang-format.fallbackStyle"
},
"clang-format.language.java.enable": {
"type": "boolean",
"default": true,
"description": "enable formatting for Java"
},
"clang-format.language.java.style": {
"type": "string",
"default": "",
"description": "clang-format fallback style for java, left empty to use clang-format.style"
"description": "clang-format fallback style for Java, left empty to use clang-format.style"
},
"clang-format.language.java.fallbackStyle": {
"type": "string",
"default": "",
"description": "clang-format fallback style for java, left empty to use clang-format.fallbackStyle"
"description": "clang-format fallback style for Java, left empty to use clang-format.fallbackStyle"
},
"clang-format.language.javascript.enable": {
"type": "boolean",
"default": true,
"description": "enable formatting for JavaScript"
},
"clang-format.language.javascript.style": {
"type": "string",
"default": "",
"description": "clang-format fallback style for javascript, left empty to use clang-format.style"
"description": "clang-format fallback style for JavaScript, left empty to use clang-format.style"
},
"clang-format.language.javascript.fallbackStyle": {
"type": "string",
"default": "",
"description": "clang-format fallback style for javascript, left empty to use clang-format.fallbackStyle"
"description": "clang-format fallback style for JavaScript, left empty to use clang-format.fallbackStyle"
},
"clang-format.language.typescript.enable": {
"type": "boolean",
"default": true,
"description": "enable formatting for TypeScript"
},
"clang-format.language.typescript.style": {
"type": "string",
"default": "",
"description": "clang-format fallback style for typescript, left empty to use clang-format.style"
"description": "clang-format fallback style for TypeScript, left empty to use clang-format.style"
},
"clang-format.language.typescript.fallbackStyle": {
"type": "string",
"default": "",
"description": "clang-format fallback style for typescript, left empty to use clang-format.fallbackStyle"
"description": "clang-format fallback style for TypeScript, left empty to use clang-format.fallbackStyle"
},
"clang-format.language.proto.enable": {
"type": "boolean",
"default": true,
"description": "enable formatting for Protobuf"
},
"clang-format.language.proto.style": {
"type": "string",
"default": "",
"description": "clang-format fallback style for proto, left empty to use clang-format.style"
"description": "clang-format fallback style for Protobuf, left empty to use clang-format.style"
},
"clang-format.language.proto.fallbackStyle": {
"type": "string",
"default": "",
"description": "clang-format fallback style for proto, left empty to use clang-format.fallbackStyle"
"description": "clang-format fallback style for Protobuf, left empty to use clang-format.fallbackStyle"
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/clangMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

import vscode = require('vscode');

const LANGUAGES: string[] = ['cpp', 'c', 'objective-c', 'java', 'javascript', 'typescript', 'proto'];
export const MODES: vscode.DocumentFilter[] = LANGUAGES.map(language => ({ language, scheme: 'file' }));
let languages: string[] = [];
for (var l of ["cpp", "c", "objective-c", "java", "javascript", "typescript", "proto"]) {
if (vscode.workspace.getConfiguration("clang-format").get("language." + l + ".enable")) {
languages.push(l);
}
}

export const MODES: vscode.DocumentFilter[] = languages.map(language => ({ language, scheme: 'file' }));

0 comments on commit 76ee630

Please sign in to comment.