Skip to content

Commit

Permalink
Merge pull request #7223 from microsoft/1_3_0_insiders2
Browse files Browse the repository at this point in the history
1.3.0-insiders2 merge
  • Loading branch information
sean-mcmanus authored Mar 24, 2021
2 parents d942d64 + 0139274 commit 437d9b3
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 70 deletions.
8 changes: 8 additions & 0 deletions Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# C/C++ for Visual Studio Code Change Log

## Version 1.3.0-insiders2: March 25, 2021
## Bug Fixes
* Fix a spurious asterisk being inserted on a new line if the previous line starts with an asterisk. [#5733](https://github.com/microsoft/vscode-cpptools/issues/5733)
* Fix random crashes of cpptools-srv during shutdown. [#7161](https://github.com/microsoft/vscode-cpptools/issues/7161)
* Change `C_Cpp.autocompleteAddParentheses` to be false by default. [#7199](https://github.com/microsoft/vscode-cpptools/issues/7199)
* Fix auto add parentheses incorrectly occurring with template methods. [#7203](https://github.com/microsoft/vscode-cpptools/issues/7203)
* Fix auto adding parentheses incorrectly occurring with type names. [#7209](https://github.com/microsoft/vscode-cpptools/issues/7209)

## Version 1.3.0-insiders: March 18, 2021
## Enhancements
* Add parentheses to function calls with autocomplete. [#882](https://github.com/microsoft/vscode-cpptools/issues/882)
Expand Down
2 changes: 1 addition & 1 deletion Extension/cpptools.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"recursiveIncludes": 100,
"gotoDefIntelliSense": 100,
"enhancedColorization": 100,
"minimumVSCodeVersion": "1.52.0"
"minimumVSCodeVersion": "1.53.0"
}
2 changes: 1 addition & 1 deletion Extension/i18n/chs/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "未能在路径 \"{0}\" 处查询编译器以获得默认标准版本。已对此编译器禁用编译器查询。",
"unrecognized_language_standard_version": "编译器查询返回了无法识别的语言标准版本。将改用受支持的最新版本。",
"intellisense_process_crash_detected": "检测到 IntelliSense 进程崩溃。",
"return_values_label": "Return values:"
"return_values_label": "返回值:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/cht/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "無法查詢位於路徑 \"{0}\" 的編譯器預設標準版本。已停用此編譯器的編譯器查詢。",
"unrecognized_language_standard_version": "編譯器查詢傳回無法辨識的語言標準版本。將改用支援的最新版本。",
"intellisense_process_crash_detected": "偵測到 IntelliSense 流程損毀。",
"return_values_label": "Return values:"
"return_values_label": "傳回值:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/csy/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "Nepovedlo se dotázat kompilátor na cestě {0} na výchozí standardní verze. Dotazování je pro tento kompilátor zakázané.",
"unrecognized_language_standard_version": "Dotaz na kompilátor vrátil nerozpoznanou standardní verzi jazyka. Místo ní se použije nejnovější podporovaná verze.",
"intellisense_process_crash_detected": "Zjistilo se chybové ukončení procesu IntelliSense.",
"return_values_label": "Return values:"
"return_values_label": "Návratové hodnoty:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/deu/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "Der Compiler im Pfad \"{0}\" konnte nicht nach standardmäßigen Standardversionen abgefragt werden. Die Compilerabfrage ist für diesen Compiler deaktiviert.",
"unrecognized_language_standard_version": "Die Compilerabfrage hat eine unbekannte Sprachstandardversion zurückgegeben. Stattdessen wird die neueste unterstützte Version verwendet.",
"intellisense_process_crash_detected": "IntelliSense-Prozessabsturz erkannt.",
"return_values_label": "Return values:"
"return_values_label": "Rückgabewerte:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/esn/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "No se pudo consultar el compilador en la ruta de acceso \"{0}\" para las versiones estándar predeterminadas. La consulta del compilador está deshabilitada para este.",
"unrecognized_language_standard_version": "La consulta del compilador devolvió una versión estándar del lenguaje no reconocida. En su lugar se usará la última versión admitida.",
"intellisense_process_crash_detected": "Se ha detectado un bloqueo del proceso de IntelliSense.",
"return_values_label": "Return values:"
"return_values_label": "Valores devueltos:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/fra/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "Échec de l'interrogation du compilateur sur le chemin \"{0}\" pour les versions normalisées par défaut. L'interrogation du compilateur est désactivée pour ce compilateur.",
"unrecognized_language_standard_version": "L'interrogation du compilateur a retourné une version de norme de langage non reconnue. La toute dernière version prise en charge va être utilisée à la place.",
"intellisense_process_crash_detected": "Détection d'un plantage du processus IntelliSense.",
"return_values_label": "Return values:"
"return_values_label": "Valeurs de retour :"
}
2 changes: 1 addition & 1 deletion Extension/i18n/jpn/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "既定の標準バージョンのパス \"{0}\" でコンパイラをクエリできませんでした。このコンパイラでは、コンパイラのクエリが無効になっています。",
"unrecognized_language_standard_version": "コンパイラ クエリにより、認識されない言語標準バージョンが返されました。代わりに、サポートされている最新のバージョンが使用されます。",
"intellisense_process_crash_detected": "IntelliSense プロセスのクラッシュが検出されました。",
"return_values_label": "Return values:"
"return_values_label": "戻り値:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/kor/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "기본 표준 버전에 대해 경로 \"{0}\"에서 컴파일러를 쿼리하지 못했습니다. 이 컴파일러에 대해서는 컴파일러 쿼리를 사용할 수 없습니다.",
"unrecognized_language_standard_version": "컴파일러 쿼리에서 인식할 수 없는 언어 표준 버전을 반환했습니다. 지원되는 최신 버전이 대신 사용됩니다.",
"intellisense_process_crash_detected": "IntelliSense 프로세스 크래시가 감지되었습니다.",
"return_values_label": "Return values:"
"return_values_label": "반환 값:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/plk/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "Nie można wykonać zapytań dotyczących kompilatora w ścieżce „{0}” dla domyślnych wersji standardowych. Wykonywanie zapytań dotyczących kompilatora jest wyłączone dla tego kompilatora.",
"unrecognized_language_standard_version": "Zapytanie kompilatora zwróciło nierozpoznaną wersję standardu języka. Zamiast tego zostanie użyta najnowsza obsługiwana wersja.",
"intellisense_process_crash_detected": "Wykryto awarię procesu funkcji IntelliSense.",
"return_values_label": "Return values:"
"return_values_label": "Wartości zwracane:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/ptb/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "Falha ao consultar compilador no caminho \"{0}\" para as versões padrão. A consulta do compilador está desabilitada para este compilador.",
"unrecognized_language_standard_version": "A consulta do compilador retornou uma versão do padrão de linguagem não reconhecida. Nesse caso, será usada a última versão com suporte.",
"intellisense_process_crash_detected": "Falha detectada no processo do IntelliSense.",
"return_values_label": "Return values:"
"return_values_label": "Valores retornados:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/rus/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "Не удалось запросить компилятор по пути \"{0}\" для стандартных версий по умолчанию. Запросы для этого компилятора отключены.",
"unrecognized_language_standard_version": "Проба компилятора возвратила нераспознанную версию стандарта языка. Вместо этого будет использоваться последняя поддерживаемая версия.",
"intellisense_process_crash_detected": "Обнаружен сбой процесса IntelliSense.",
"return_values_label": "Return values:"
"return_values_label": "Возвращаемые значения:"
}
2 changes: 1 addition & 1 deletion Extension/i18n/trk/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"c_cpp.configuration.vcpkg.enabled.markdownDescription": "[vcpkg bağımlılık yöneticisi](https://aka.ms/vcpkg/) için tümleştirme hizmetlerini etkinleştirin.",
"c_cpp.configuration.addNodeAddonIncludePaths.description": "nan ve node-addon-api bağımlılık olduğunda bunlardan ekleme yolları ekleyin.",
"c_cpp.configuration.renameRequiresIdentifier.description": "True ise, 'Sembolü Yeniden Adlandır' işlemi için geçerli bir C/C++ tanımlayıcısı gerekir.",
"c_cpp.configuration.autocompleteAddParentheses.description": "If true, autocomplete will automatically add \"(\" after function calls, in which case \")\" may also be added, depending on the value of the \"editor.autoClosingBrackets\" setting.",
"c_cpp.configuration.autocompleteAddParentheses.description": "True ise otomatik tamamla özelliği, işlev çağrılarından sonra otomatik olarak \"(\" ekler. Bazı durumlarda \"editor.autoClosingBrackets\" ayarının değerine bağlı olarak \")\" karakteri de eklenebilir.",
"c_cpp.configuration.debugger.useBacktickCommandSubstitution.description": "True ise, hata ayıklayıcı kabuk komut değiştirme eski kesme işaretini (`) kullanır.",
"c_cpp.contributes.views.cppReferencesView.title": "C/C++: Diğer başvuru sonuçları",
"c_cpp.debuggers.pipeTransport.description": "Mevcut olduğunda, hata ayıklayıcısına, VS Code ile MI özellikli hata ayıklayıcısı arka uç yürütülebilir dosyası (gdb gibi) arasında standart giriş/çıkış geçişi sağlayan bir kanal olarak görev yapacak başka bir yürütülebilir dosya aracılığıyla uzak bilgisayara bağlanmasını söyler.",
Expand Down
2 changes: 1 addition & 1 deletion Extension/i18n/trk/src/nativeStrings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@
"failed_to_query_for_standard_version": "Varsayılan standart sürümler için \"{0}\" yolundaki derleyici sorgulanamadı. Derleyici sorgulaması bu derleyici için devre dışı bırakıldı.",
"unrecognized_language_standard_version": "Derleyici sorgusu, tanınmayan bir dil standardı sürümü döndürdü. Bunun yerine desteklenen en güncel sürüm kullanılacak.",
"intellisense_process_crash_detected": "IntelliSense işlem kilitlenmesi saptandı.",
"return_values_label": "Return values:"
"return_values_label": "Dönüş değerleri:"
}
6 changes: 3 additions & 3 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"license": "SEE LICENSE IN LICENSE.txt",
"engines": {
"vscode": "^1.52.0"
"vscode": "^1.53.0"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode-cpptools/issues",
Expand Down Expand Up @@ -1160,7 +1160,7 @@
},
"C_Cpp.autocompleteAddParentheses": {
"type": "boolean",
"default": true,
"default": false,
"description": "%c_cpp.configuration.autocompleteAddParentheses.description%",
"scope": "resource"
}
Expand Down Expand Up @@ -2409,7 +2409,7 @@
"@types/plist": "^3.0.2",
"@types/semver": "^7.1.0",
"@types/tmp": "^0.1.0",
"@types/vscode": "1.52.0",
"@types/vscode": "1.53.0",
"@types/webpack": "^4.39.0",
"@types/which": "^1.3.2",
"@types/yauzl": "^2.9.1",
Expand Down
89 changes: 50 additions & 39 deletions Extension/src/LanguageServer/languageConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export interface CommentPattern {
continue: string;
}

interface Rules {
begin: vscode.OnEnterRule[];
continue: vscode.OnEnterRule[];
end: vscode.OnEnterRule[];
}

const escapeChars: RegExp = /[\\\^\$\*\+\?\{\}\(\)\.\!\=\|\[\]\ \/]/; // characters that should be escaped.

// Insert '\\' in front of regexp escape chars.
Expand Down Expand Up @@ -47,36 +53,43 @@ function getMLSplitAfterPattern(): string {
return "^\\s*\\*\\/$";
}

function getMLPreviousLinePattern(insert: string): string | undefined {
if (insert.startsWith("/*")) {
return `\\A(?=^(\\s*(\\/\\*\\*|\\*)).*)(?=(?!(\\s*\\*\\/)))`;
}
return undefined;
}

function getMLContinuePattern(insert: string): string | undefined {
if (insert) {
const match: string = escape(insert.trimRight());
if (match) {
const right: string = escape(insert.substr(insert.trimRight().length));
return `^\\s*${match}(${right}([^\\*]|\\*(?!\\/))*)?$`;
return `^(\\t|[ ])*${match}(${right}([^\\*]|\\*(?!\\/))*)?$`;
}
// else: if the continuation is just whitespace, vscode already does indentation preservation.
}
return undefined;
}

function getMLEndPattern(insert: string): string | undefined {
const match: string = escape(insert.trimRight().trimLeft());
if (match) {
return `^\\s*${match}[^/]*\\*\\/\\s*$`;
}
// else: if the continuation is just whitespace, don't mess with indentation
// since we don't know if this is a continuation line or not.
return undefined;
}

function getMLEmptyEndPattern(insert: string): string | undefined {
insert = insert.trimRight();
if (insert !== "") {
if (insert.endsWith('*')) {
insert = insert.substr(0, insert.length - 1);
}
const match: string = escape(insert.trimRight());
return `^\\s*${match}\\*\\/\\s*$`;
return `^(\\t|[ ])*${match}\\*\\/\\s*$`;
}
// else: if the continuation is just whitespace, don't mess with indentation
// since we don't know if this is a continuation line or not.
return undefined;
}

function getMLEndPattern(insert: string): string | undefined {
const match: string = escape(insert.trimRight().trimLeft());
if (match) {
return `^(\\t|[ ])*${match}[^/]*\\*\\/\\s*$`;
}
// else: if the continuation is just whitespace, don't mess with indentation
// since we don't know if this is a continuation line or not.
Expand Down Expand Up @@ -135,25 +148,29 @@ function getMLFirstLineRule(comment: CommentPattern): vscode.OnEnterRule | undef

// When Enter is pressed while the cursor is after the continuation pattern
function getMLContinuationRule(comment: CommentPattern): vscode.OnEnterRule | undefined {
const continuePattern: string | undefined = getMLContinuePattern(comment.continue);
if (continuePattern) {
return {
beforeText: new RegExp(continuePattern),
action: {
indentAction: vscode.IndentAction.None,
appendText: comment.continue.trimLeft()
}
};
const previousLinePattern: string | undefined = getMLPreviousLinePattern(comment.begin);
if (previousLinePattern) {
const beforePattern: string | undefined = getMLContinuePattern(comment.continue);
if (beforePattern) {
return {
beforeText: new RegExp(beforePattern),
previousLineText: new RegExp(previousLinePattern),
action: {
indentAction: vscode.IndentAction.None,
appendText: comment.continue.trimLeft()
}
};
}
}
return undefined;
}

// When Enter is pressed while the cursor is after '*/' (and '*/' plus leading whitespace is all that is on the line)
function getMLEndRule(comment: CommentPattern): vscode.OnEnterRule | undefined {
const endPattern: string | undefined = getMLEndPattern(comment.continue);
if (endPattern) {
const beforePattern: string | undefined = getMLEndPattern(comment.continue);
if (beforePattern) {
return {
beforeText: new RegExp(endPattern),
beforeText: new RegExp(beforePattern),
action: {
indentAction: vscode.IndentAction.None,
removeText: comment.continue.length - comment.continue.trimLeft().length
Expand All @@ -165,10 +182,10 @@ function getMLEndRule(comment: CommentPattern): vscode.OnEnterRule | undefined {

// When Enter is pressed while the cursor is after the continuation pattern and '*/'
function getMLEmptyEndRule(comment: CommentPattern): vscode.OnEnterRule | undefined {
const endPattern: string | undefined = getMLEmptyEndPattern(comment.continue);
if (endPattern) {
const beforePattern: string | undefined = getMLEmptyEndPattern(comment.continue);
if (beforePattern) {
return {
beforeText: new RegExp(endPattern),
beforeText: new RegExp(beforePattern),
action: {
indentAction: vscode.IndentAction.None,
removeText: comment.continue.length - comment.continue.trimLeft().length
Expand All @@ -180,9 +197,9 @@ function getMLEmptyEndRule(comment: CommentPattern): vscode.OnEnterRule | undefi

// When the continue rule is different than the begin rule for single line comments
function getSLFirstLineRule(comment: CommentPattern): vscode.OnEnterRule {
const continuePattern: string = getSLBeginPattern(comment.begin);
const beforePattern: string = getSLBeginPattern(comment.begin);
return {
beforeText: new RegExp(continuePattern),
beforeText: new RegExp(beforePattern),
action: {
indentAction: vscode.IndentAction.None,
appendText: comment.continue.trimLeft()
Expand All @@ -192,9 +209,9 @@ function getSLFirstLineRule(comment: CommentPattern): vscode.OnEnterRule {

// When Enter is pressed while the cursor is after the continuation pattern plus at least one other character.
function getSLContinuationRule(comment: CommentPattern): vscode.OnEnterRule {
const continuePattern: string = getSLContinuePattern(comment.continue);
const beforePattern: string = getSLContinuePattern(comment.continue);
return {
beforeText: new RegExp(continuePattern),
beforeText: new RegExp(beforePattern),
action: {
indentAction: vscode.IndentAction.None,
appendText: comment.continue.trimLeft()
Expand All @@ -204,22 +221,16 @@ function getSLContinuationRule(comment: CommentPattern): vscode.OnEnterRule {

// When Enter is pressed while the cursor is immediately after the continuation pattern
function getSLEndRule(comment: CommentPattern): vscode.OnEnterRule {
const endPattern: string = getSLEndPattern(comment.continue);
const beforePattern: string = getSLEndPattern(comment.continue);
return {
beforeText: new RegExp(endPattern),
beforeText: new RegExp(beforePattern),
action: {
indentAction: vscode.IndentAction.None,
removeText: comment.continue.length - comment.continue.trimLeft().length
}
};
}

interface Rules {
begin: vscode.OnEnterRule[];
continue: vscode.OnEnterRule[];
end: vscode.OnEnterRule[];
}

export function getLanguageConfig(languageId: string): vscode.LanguageConfiguration {
const settings: CppSettings = new CppSettings();
const patterns: (string | CommentPattern)[] | undefined = settings.commentContinuationPatterns;
Expand Down
Loading

0 comments on commit 437d9b3

Please sign in to comment.