[ISSUE] retained keyword not recognized in Particle Workbench

Using the type keyword retained in Particle Workbench gives an error: explicit type is missing ('int' assumed) (EDIT: an error in the “PROBLEMS” section of VSCode, not in the compilation process)

code to reproduce:
retained char test_char;

Audit Env if it matters:


*** WARNING: MAY CONTAIN CONFIDENTIAL INFORMATION - PLEASE SANITIZE BEFORE SHARING ***
To report an issue, visit:
https://community.particle.io/t/information-how-to-report-bugs-and-provide-feedback/44245

{
    "username": "",
    "workspace": {
        "name": "gateway-firmware (Workspace)",
        "isWorkspace": true,
        "folders": [
            {
                "location": "/Users/justicereed/Documents/Engineering/Hardware/gateway-firmware",
                "settings": {
                    "firmwareName": "deviceOS",
                    "firmwareVersion": "0.6.4",
                    "targetDevice": "",
                    "targetPlatform": "electron",
                    "disableWelcomeScreen": false
                },
                "files": [
                ]
            }
        ]
    },
    "cli": {
        "binpath": "/Users/justicereed/.vscode/extensions/particle.particle-vscode-core-1.0.0-alpha.7/src/cli/bin/darwin/amd64/particle",
        "ok": true,
        "version": "1.37.0"
    },
    "localCompiler": {
        "dependencies": [
            "deviceOS@1.0.0",
            "gcc-arm@5.3.1",
            "buildtools@1.0.1",
            "buildscripts@1.0.1",
            "deviceOS@0.7.0",
            "deviceOS@0.6.4",
            "gcc-arm@4.9.3",
            "deviceOS@0.6.3"
        ]
    },
    "platform": {
        "os": "darwin",
        "type": "Darwin",
        "release": "18.0.0",
        "arch": "x64",
        "path": {
            "key": "PATH",
            "value": "/Users/justicereed/.nvm/versions/node/v8.9.4/bin:/Users/justicereed/Library/Python/3.6/bin:/Users/justicereed/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin"
        },
        "homeDir": "/Users/justicereed",
        "particleDir": "/Users/justicereed/.particle",
        "localCompilerToolchainDir": "/Users/justicereed/.particle/toolchains"
    },
    "env": {
        "TMPDIR": "/var/folders/60/_39c6nf109v28rbbvzcwwxnh0000gn/T/",
        "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
        "SHELL": "/bin/bash",
        "HOME": "/Users/justicereed",
        "Apple_PubSub_Socket_Render": "/private/tmp/com.apple.launchd.d5yGv5hPUK/Render",
        "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.CEQc881I3b/Listeners",
        "PATH": "/Users/justicereed/.nvm/versions/node/v8.9.4/bin:/Users/justicereed/Library/Python/3.6/bin:/Users/justicereed/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin",
        "LOGNAME": "justicereed",
        "XPC_SERVICE_NAME": "com.microsoft.VSCode.1508",
        "USER": "justicereed",
        "XPC_FLAGS": "0x0",
        "VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
        "VSCODE_NODE_CACHED_DATA_DIR": "/Users/justicereed/Library/Application Support/Code/CachedData/61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8",
        "VSCODE_LOGS": "/Users/justicereed/Library/Application Support/Code/logs/20190111T111835",
        "VSCODE_IPC_HOOK": "/Users/justicereed/Library/Application Support/Code/1.30.2-main.sock",
        "VSCODE_PID": "62771",
        "NVM_BIN": "/Users/justicereed/.nvm/versions/node/v8.9.4/bin",
        "NVM_CD_FLAGS": "",
        "NVM_DIR": "/Users/justicereed/.nvm",
        "PWD": "/",
        "SHLVL": "1",
        "_": "/Applications/Visual Studio Code.app/Contents/MacOS/Electron",
        "AMD_ENTRYPOINT": "vs/workbench/node/extensionHostProcess",
        "PIPE_LOGGING": "true",
        "VERBOSE_LOGGING": "true",
        "VSCODE_IPC_HOOK_EXTHOST": "/var/folders/60/_39c6nf109v28rbbvzcwwxnh0000gn/T/vscode-ipc-9e4af412-d1ce-4934-adbb-04e294b9f363.sock",
        "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
        "VSCODE_LOG_STACK": "false",
        "VSCODE_LOG_LEVEL": "undefined",
        "VSCODE_PREVENT_FOREIGN_INSPECT": "true",
        "CRASH_REPORTER_START_OPTIONS": "{\"companyName\":\"Microsoft\",\"productName\":\"VSCode\",\"submitURL\":\"https://rink.hockeyapp.net/api/2/apps/21a48a66799e47fea4f52c0ff81e803d/crashes/upload\",\"extra\":{\"vscode_version\":\"1.30.2\",\"vscode_commit\":\"61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8\",\"vscode_sessionId\":\"5c030a22-3a3d-4c0c-97e2-9f1cd13d25ad1547848303543\",\"processName\":\"extensionHost\"},\"crashesDirectory\":\"/var/folders/60/_39c6nf109v28rbbvzcwwxnh0000gn/T\"}",
        "ELECTRON_RUN_AS_NODE": "1",
        "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "true"
    },
    "versions": {
        "http_parser": "2.7.0",
        "node": "8.9.3",
        "v8": "6.1.534.41",
        "uv": "1.15.0",
        "zlib": "1.2.11",
        "ares": "1.10.1-DEV",
        "modules": "57",
        "nghttp2": "1.25.0",
        "openssl": "1.0.2n"
    },
    "vscode": {
        "appName": "Visual Studio Code",
        "appRoot": "/Applications/Visual Studio Code.app/Contents/Resources/app",
        "machineId": "4cc4cb9a12ea10c756da5e4376e9dea6d7c38af8833f85573107faa9b6beb4e8",
        "sessionId": "5c030a22-3a3d-4c0c-97e2-9f1cd13d25ad1547848303543",
        "version": "1.30.2"
    },
    "extensions": [
        {
            "id": "ms-vscode.node-debug",
            "version": "1.30.4"
        },
        {
            "id": "ms-vscode.node-debug2",
            "version": "1.30.3"
        },
        {
            "id": "ms-vscode.references-view",
            "version": "0.0.18"
        },
        {
            "id": "marus25.cortex-debug",
            "version": "0.1.21"
        },
        {
            "id": "ms-vscode.cpptools",
            "version": "0.20.1"
        },
        {
            "id": "particle.particle-vscode-core",
            "version": "1.0.0-alpha.7"
        },
        {
            "id": "particle.particle-vscode-snippets",
            "version": "1.0.0-alpha.7"
        },
        {
            "id": "particle.particle-vscode-theme",
            "version": "1.0.0-alpha.7"
        }
    ]
}

*** WARNING: MAY CONTAIN CONFIDENTIAL INFORMATION - PLEASE SANITIZE BEFORE SHARING ***
To report an issue, visit:
https://community.particle.io/t/information-how-to-report-bugs-and-provide-feedback/44245

Strange, I can’t reproduce your issue.
Granted, IntelliSense doesn’t know retained yet (which is a known issue) but that does not have any impact on the actual build for me.

In the image below you see that the build succeeded

Correct, sorry, I realize that I wasn’t super clear. The compilation toolchain works fine for me as well. I’m talking about the recognition of retained as a keyword in VSCode via the Workbench plugin and related config. As far as that being a known issue, I didn’t see it anywhere on this forum to the best of my search ability.

It’s not documented as an issue specifically for the retained keyword, but in general some stubbornness of IntelliSense
https://community.particle.io/search?q=intellisense

2 Likes

Got it, thanks, had missed those links.

yep, intellisense :disappointed:

fwiw, i’ll be digging in there a bit more over the next few weeks.

1 Like

Weird thing – this morning I had opened up a Particle Workbench project that I hadn’t looked at in a few days. The retained keyword wasn’t being flagged, but all my #includes were. But I saw an alert in the IDE which said something about how “particle wants to enable [configure? don’t remember exactly] Intellisense in this workspace”, or words to that effect. Once I clicked okay on that, my #includes were fine, but retained got flagged again. :man_shrugging:

hey all :wave:

looks like MS just pushed out an update to the cpptools extension which drives intellisense. can you all confirm you have v0.21.0 installed (the Particle: Audit Environment command will list your currently installed extensions and their versions if you aren’t sure where to check) and see if any of your issues are resolved? :pray::+1:

I’ve got

        {
            "id": "ms-vscode.cpptools",
            "version": "0.21.0"
        },

but retained is still flagged as unknown.

2 Likes

Same, still see the retained keyword highlighted. I didn’t have any other specific highlighting issues to compare any difference to.

1 Like

ah, tracked it down.

short-term, you can add:

#include "deepsleep_hal_impl.h" (gen 2 hw - e.g. photon, electron)
or
#include "platform_headers.h" (gen 3 hw - e.g. argon, boron, xenon)

to your top-level file and it should resolve the “problem”. in the meantime, i’ll get a fix in for the next update :+1:

3 Likes