Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intellisense not using IAR include paths (C++ MSP430) #110

Open
LukasP opened this issue Oct 6, 2021 · 1 comment
Open

Intellisense not using IAR include paths (C++ MSP430) #110

LukasP opened this issue Oct 6, 2021 · 1 comment

Comments

@LukasP
Copy link

LukasP commented Oct 6, 2021

With the default configuration, intellisense can't find any includes outside of my project folders even though includePath in c_cpp_properties.json contains the compiler include directories:

"includePath": [
    "C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 8.5\\430\\inc\\dlib",
    "C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 8.5\\430\\inc",
    "C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 8.5\\430\\inc\\dlib\\c",
    "C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 8.5\\430\\inc\\dlib\\ecpp"
    // project specific dirs omitted
]

Intellisense helpfully offers: #include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit

To Reproduce
1: install the extension
2: add IAR compiler path, workbench path and project file for MSP430 C++ project
3: include a header eg <cstdint>

Additional context
If I comment out "configurationProvider": "pluyckx.iar-vsc" in c_cpp_properties.json, intellisense does find headers in the IAR include paths, checked by Go to Definition of a header and looking at the file path.

@LukasP
Copy link
Author

LukasP commented Oct 29, 2021

Looking at the C/C++ log diagnostics it seems the Translation Unit Configurations for each file do not have the IAR directories in the includes list, only the project specific directories.

I'd like to test if this is what causes the issue by adding the IAR paths to each file's generated include list but idk how to get the extension to run with modifications (never did anything with js/ts):

In includepath.ts:

    export function fromCompilerOutput(output: string): IncludePath[] {
        let includes: IncludePath[] = [];

        let regex = /\$\$INC_BEGIN\s\$\$FILEPATH\s\"([^"]*)/g;
        let result: RegExpExecArray | null = null;
        do {
            result = regex.exec(output);

            if (result !== null && (result.length === 2)) {
                let p = result[1].replace(/\\\\/g, "\\");

                try {
                    let stat = Fs.statSync(p);

                    if (stat.isDirectory()) {
                        includes.push(new StringIncludePath(p));
                    }
                } catch (e) {
                }
            }
        } while (result);

        includes.push(new StringIncludePath("C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 8.5\\430\\inc"));
        includes.push(new StringIncludePath("C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 8.5\\430\\inc\\dlib"));
        includes.push(new StringIncludePath("C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 8.5\\430\\inc\\dlib\\c"));

        return includes;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant