Comments (17)
@rohit-kumar-j I am using mingw, at the moment, so no idea if it works or not.
@Civitasv Nope, I played a bit with Windows policies, but also no luck (Windows 11).
from cmake-tools.nvim.
This plugin use symlink to achieve that, why not use .clangd
?
from cmake-tools.nvim.
But switches between release types are initiated by plugin. It is inconvenient to change path to compilation database every time by hand
from cmake-tools.nvim.
Make sense, I will see how i can implement it.
from cmake-tools.nvim.
Something like this in init.lua:125
, inside on_success
function after running the CMake command. What I can't figure out how to delete the file when exiting the editor.
local compile_commands = config.build_directory.filename .. "/compile_commands.json"
local cmd = "[ -e " .. compile_commands .. " ] && cp " .. compile_commands .. " ."
local handle = io.popen(cmd)
handle:close()
from cmake-tools.nvim.
Platform independent solution.
diff --git a/lua/cmake-tools/init.lua b/lua/cmake-tools/init.lua
index 7293c22..6cf7518 100644
--- a/lua/cmake-tools/init.lua
+++ b/lua/cmake-tools/init.lua
@@ -127,6 +127,13 @@ function cmake.generate(opt, callback)
if type(callback) == "function" then
callback()
end
+
+ local infile = io.open(config.build_directory.filename .. "/compile_commands.json", "r")
+ local outfile = io.open("compile_commands.json", "w")
+
+ outfile:write(infile:read("*a"))
+ outfile:close()
+ infile:close()
end,
cmake_console_position = const.cmake_console_position,
cmake_show_console = const.cmake_show_console,
from cmake-tools.nvim.
Is there any reason to copy it instead of just making symlink?
from cmake-tools.nvim.
@ayles Because it should be platform independent and I haven't seen anything in the LUA file api that allows to create symbolic links. On Linux you would use ln -s
and on Windows mklink
.
from cmake-tools.nvim.
@iFuSiiOnzZ Why not use vim.cmd("term ln -s")
?
from cmake-tools.nvim.
I've added this ability. See 6e4e422
from cmake-tools.nvim.
Haven't test in on Linux yet. On Windows there are a some problems.
Powershell normal user
CMake Error: failed to create symbolic link 'C:\Users\Develop\Projects\ls/compile_commands.json': A required privilege is not held by the client.
Powershell with admin privileges
:!cmake -E create_symlink cmake_build_Debug/compile_commands.json C:\Users\AndreiAJ\Projects\ls/compile_commands.json
from cmake-tools.nvim.
@iFuSiiOnzZ, I did you try compile_commands with MSVC on powershell?
from cmake-tools.nvim.
Powershell with admin privileges
When in admin privileges, Was the command successful?
from cmake-tools.nvim.
Can you show the error messages?
from cmake-tools.nvim.
For some reason the neovim log is empty and cmake reports nothing about the error.
What is more strange... I ran cmake -E create_symlink
from the terminal and it worked.
from cmake-tools.nvim.
That's interesting.
from cmake-tools.nvim.
Look at this.
from cmake-tools.nvim.
Related Issues (20)
- Unexpected input keys in Neovim due to autocommand HOT 2
- How to get current cmake args in neovim's lua? HOT 3
- Possibility to set a path for `cmake_build_directory` that is not relative to `vim.loop.cwd()` HOT 2
- if executor is terminal, then no double quotes around path to build folder HOT 3
- Command: CMakeStopRunner not working when using toggleterm. HOT 1
- CMakeGenerate does not work HOT 2
- Toggleterm executor opens new tab instead of rewriting existing one
- Error during the lazy initialization, when it is triggered by pressing hotkeys HOT 11
- Wrong cwd when running CTest -> runner doesn't pass arguments when running CTest HOT 3
- Symlink compile_commands.json doesn't appear to work on windows HOT 7
- quick start HOT 4
- on_exit in default terminal.lua HOT 1
- How to choose target when every build/run HOT 18
- targets in buildPresets of CMakePresets.json not honored
- Build Directory Creation will Fail if it Requires a Recursive Create on Windows HOT 4
- Build Directory and Build Targets Not Always Found HOT 11
- Support fish shell HOT 4
- CMakeRun No Output on Windows HOT 5
- Slowdown every time cursor is moved HOT 4
- Whitespace makes CMakeGenerate error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmake-tools.nvim.