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

Auto add matlab C/C++ headers to search path #163

Open
SpieringsAE opened this issue Jul 20, 2024 · 3 comments
Open

Auto add matlab C/C++ headers to search path #163

SpieringsAE opened this issue Jul 20, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@SpieringsAE
Copy link

Is your feature request related to a problem? Please describe.
I write a bit of Cmex and level 2 s functions in C, and it is quite annoying to not have proper function signatures and such for the C lsp. I think I can add these paths manually, but I wonder if it could be done automatically by this extension.

Describe the solution you'd like
Add available matlab C/C++ headers to search path, maybe based on the configured matlab path?

Describe alternatives you've considered
Manually extracting the path variable from matlab, formatting that and adding it to the search path maybe via the .vscode/settings.json file

@SpieringsAE SpieringsAE added the enhancement New feature or request label Jul 20, 2024
@dklilley
Copy link
Member

Hi @SpieringsAE, thanks for the request! To help better understand this, can you add reproduction steps as well as details about what behavior you are seeing and what behavior you would expect?

Thanks!

@SpieringsAE
Copy link
Author

Okay
Reproduction:

  1. In a matlab project make a C file, for example, my_cmex.c
  2. Add #include "mex.h" to get access to the Matlab Cmex functions
  3. Get an error/warning that mex.h is unknown
  4. Have no autocomplete or information about the functions in mex.h as a result

Expected behaviour:
mex.h is detected and autocomplete/function documentation can be gathered from it.

To fix this manually I have added in .vscode/settings.json:

"C_Cpp.default.includePath": [
	"/home/user/.local/share/MATLAB/R2024a/extern/include/",
	"/home/user/.local/share/MATLAB/R2024a/simulink/include/",
	"/home/user/.local/share/MATLAB/R2024a/toolbox/rtw/accel/accelTemplateFolder",
	"/home/user/.local/share/MATLAB/R2024a/toolbox/rtw/targets/common/can/datatypes",
	"/home/user/.local/share/MATLAB/R2024a/toolbox/shared/can/src/scanutil",
	"/home/user/.local/share/MATLAB/R2024a/rtw/c/src"
]

These paths will be different depending on where Matlab is installed.

I'm not quite sure if these paths can be added by an extension like this.

@dklilley
Copy link
Member

Thanks for adding that context!

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

No branches or pull requests

2 participants