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

Set path to compileCommands automatically. #247

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Symbitic
Copy link

@Symbitic Symbitic commented Jan 5, 2024

I'm not sure if this is a feature or a bug fix, but this removes the need for setting the path to the compile commands file in .vscode/c_cpp_properties.json by setting C_Cpp.default.compileCommands.

With this, IntelliSense should work as soon as XMake is run for the first time.

@waruqi
Copy link
Member

waruqi commented Jan 5, 2024

If the user does not have cpptools installed and is only using clangd. Does it work? https://xmake.io/#/plugin/more_plugins?id=clangd

const compileCommandsFile = path.join(config.compileCommandsDirectory, "compile_commands.json");
const compileCommandsWatcher = vscode.workspace.createFileSystemWatcher(compileCommandsFile);
compileCommandsWatcher.onDidCreate(() => {
const config = vscode.workspace.getConfiguration('C_Cpp');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user does not have cpptools installed, do we always get a valid config instead of undefined?

@123485k
Copy link

123485k commented Jan 6, 2024

可以参考下cmake插件的实现vscode-cmake-tools/src/cpptools.ts
使用ConfigurationProvider可以无需编辑配置文件,自动让Cpptools使用xmake生成的配置

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

Successfully merging this pull request may close these issues.

None yet

3 participants