From 3c1e7a96934e077494b63aadf263f3b47e7af8b4 Mon Sep 17 00:00:00 2001 From: Lou Amadio Date: Sat, 6 Nov 2021 15:34:22 -0700 Subject: [PATCH 1/2] Update C++ properties to for intellisense --- package-lock.json | 32 +++++++++++++++++++++++--------- package.json | 8 ++++---- src/extension.ts | 4 ++-- src/ros/build-env-utils.ts | 13 ++++++++++--- 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32a6282b..8f7a747a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,9 +37,9 @@ "dev": true }, "@types/glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-w+LsMxKyYQm347Otw+IfBXOv9UWVjpHpCDdbBMt8Kz/xbvCYNjP+0qPh91Km3iKfSRLBB0P7fAMf0KHrPu+MyA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", "dev": true, "requires": { "@types/minimatch": "*", @@ -83,9 +83,9 @@ "dev": true }, "@types/vscode": { - "version": "1.56.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.56.0.tgz", - "integrity": "sha512-Q5VmQxOx+L1Y6lIJiGcJzwcyV3pQo/eiW8P+7sNLhFI16tJCwtua2DLjHRcpjbCLNVYpQM73kzfFo1Z0HyP9eQ==", + "version": "1.62.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.62.0.tgz", + "integrity": "sha512-iGlQJ1w5e3qPUryroO6v4lxg3ql1ztdTCwQW3xEwFawdyPLoeUSv48SYfMwc7kQA7h6ThUqflZIjgKAykeF9oA==", "dev": true }, "@types/xmlrpc": { @@ -457,9 +457,9 @@ "dev": true }, "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -816,6 +816,20 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", diff --git a/package.json b/package.json index 4dfb585d..b6c99eee 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.6.9", "publisher": "ms-iot", "engines": { - "vscode": "^1.56.0" + "vscode": "^1.62.0" }, "author": { "name": "Microsoft Corporation" @@ -364,15 +364,15 @@ "xmlrpc": "^1.3.2" }, "devDependencies": { - "@types/glob": "^7.1.4", + "@types/glob": "^7.2.0", "@types/js-yaml": "^4.0.4", "@types/mocha": "^9.0.0", "@types/node": "^16.11.6", "@types/shell-quote": "^1.7.1", "@types/tmp": "^0.2.2", - "@types/vscode": "^1.56.0", + "@types/vscode": "^1.62.0", "@types/xmlrpc": "^1.3.7", - "glob": "^7.1.7", + "glob": "^7.2.0", "mocha": "^9.1.3", "tslint": "^6.1.3", "typescript": "^4.4.4", diff --git a/src/extension.ts b/src/extension.ts index 46a11375..755e610e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -254,10 +254,10 @@ function activateEnvironment(context: vscode.ExtensionContext, buildToolDetected else { subscriptions.push( vscode.commands.registerCommand(Commands.CreateCatkinPackage, () => { - vscode.window.showErrorMessage(`${Commands.CreateCatkinPackage} requires a catkin workspace to be opened`); + vscode.window.showErrorMessage(`${Commands.CreateCatkinPackage} requires a ROS workspace to be opened`); }), vscode.commands.registerCommand(Commands.Rosdep, () => { - vscode.window.showErrorMessage(`${Commands.Rosdep} requires a catkin workspace to be opened`); + vscode.window.showErrorMessage(`${Commands.Rosdep} requires a ROS workspace to be opened`); }), ); } diff --git a/src/ros/build-env-utils.ts b/src/ros/build-env-utils.ts index 5454773a..f64c07e3 100644 --- a/src/ros/build-env-utils.ts +++ b/src/ros/build-env-utils.ts @@ -47,7 +47,7 @@ async function updateCppPropertiesInternal(): Promise { const workspaceIncludes = await rosApi.getWorkspaceIncludeDirs(extension.baseDir); includes = includes.concat(workspaceIncludes); - if (process.platform !== "win32") { + if (process.platform === "win32") { includes.push(path.join("/", "usr", "include")); } @@ -61,8 +61,8 @@ async function updateCppPropertiesInternal(): Promise { configurations: [ { browse: { - databaseFilename: "", - limitSymbolsToIncludedHeaders: true, + databaseFilename: "${workspaceFolder}/.vscode/browse.vc.db", + limitSymbolsToIncludedHeaders: false, }, includePath: includes, name: "ROS", @@ -71,6 +71,13 @@ async function updateCppPropertiesInternal(): Promise { version: 4, }; + if (process.platform === "linux") { + cppProperties.configurations[0].intelliSenseMode = "gcc-" + process.arch + cppProperties.configurations[0].compilerPath = "/usr/bin/gcc" + cppProperties.configurations[0].cStandard = "gnu11" + cppProperties.configurations[0].cppStandard = "c++14" + } + // Ensure the ".vscode" directory exists then update the C++ path. const dir = path.join(vscode.workspace.rootPath, ".vscode"); From 271b5c616695230e43e039f8acf8020d97269af1 Mon Sep 17 00:00:00 2001 From: Lou Amadio Date: Sun, 7 Nov 2021 08:31:10 -0800 Subject: [PATCH 2/2] Found bug switching between Windows and Linux --- src/ros/build-env-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ros/build-env-utils.ts b/src/ros/build-env-utils.ts index f64c07e3..7ed76cd1 100644 --- a/src/ros/build-env-utils.ts +++ b/src/ros/build-env-utils.ts @@ -47,7 +47,7 @@ async function updateCppPropertiesInternal(): Promise { const workspaceIncludes = await rosApi.getWorkspaceIncludeDirs(extension.baseDir); includes = includes.concat(workspaceIncludes); - if (process.platform === "win32") { + if (process.platform === "linux") { includes.push(path.join("/", "usr", "include")); }