-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
CMake: Set up Visual D when using the Visual Studio generator #3494
Conversation
For a smooth out-of-the-box experience after something like: cmake ..\ldc -G "Visual Studio 16 2019" -A x64 -DLLVM_ROOT_DIR=C:\LDC\LLVM-x64 -DD_COMPILER=C:\LDC\ldc2-1.22.0-windows-multilib\bin\ldmd2
FYI @rainers. Apparently it's not a perfect solution (https://cmake.org/cmake/help/latest/prop_tgt/VS_USER_PROPS.html), but it seems to suffice in my case (edit & debug in VS, build in the shell with ninja) - tested with Visual D v1.0. There are still no Visual D properties for the project, I guess that would require adding some dummy |
Btw Rainer, the back button on my mouse doesn't navigate backward after jumping with F12 (over the editor; nothing happens). The navigation buttons in the toolbar work as expected, but the extra mouse buttons don't (but do for C++ files). |
Indeed, the options only appear if there is at least one file included for rule |
IIRC that functionality is not covered by any command that can be reimplemented, but has to be done by explicit mouse handling hooking into the text editor. Something similar has been added recently to Visual D, so I might be able to revisit that. |
Thx for the |
2b14594
to
ef63863
Compare
Nice.
Adding this to the DCompile section in your prop file should work:
I think cmake doesn't enable parallel compilation by default, adding this to your prop file might help:
|
Thx, |
I guess that happens because you switched the default compiler in the props file. The position of the import might also be a factor, |
I've just transplanted that property from .vcxproj to .props, just like the other settings, which can all be overridden from the GUI. It's not even overridable in the .vcxproj (shows up as bold, but used compiler and compiler shown in the lhs properties tree remains LDC). - Anyway, no big deal at all. |
@rainers: Can you point me to some commit/PR? It's really a minor feature I can hardly live without... :] |
I was thinking about one of these mouse handlers: Maybe this extension is helpful: https://marketplace.visualstudio.com/items?itemName=SamHarwell.MouseNavigation Edit: just looked at its source: maybe very easy to add to the |
Thx; I've had a go, but failed to build the vdext15 project and gave up. I'd be more than happy to test a build - here's the patch: --- a/vdextensions/gotodef.cs
+++ b/vdextensions/gotodef.cs
@@ -182,6 +182,7 @@ namespace vdext15
var buffer = view.TextBuffer;
IOleCommandTarget shellCommandDispatcher = GetShellCommandDispatcher(view);
+ IVsUIShell vsUIShell = GetVsUIShell();
if (shellCommandDispatcher == null)
return null;
@@ -196,6 +197,7 @@ namespace vdext15
return new GoToDefMouseHandler(view,
shellCommandDispatcher,
+ vsUIShell,
_aggregatorFactory.GetClassifier(buffer),
_navigatorService.GetTextStructureNavigator(buffer),
CtrlKeyState.GetStateForView(view));
@@ -211,6 +213,14 @@ namespace vdext15
return _globalServiceProvider.GetService(typeof(SUIHostCommandDispatcher)) as IOleCommandTarget;
}
+ /// <summary>
+ /// Get the SVsUIShell from the global service provider.
+ /// </summary>
+ private IVsUIShell GetVsUIShell()
+ {
+ return _globalServiceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
+ }
+
#endregion
}
@@ -225,12 +235,14 @@ namespace vdext15
private IClassifier _aggregator;
private ITextStructureNavigator _navigator;
private IOleCommandTarget _commandTarget;
+ private IVsUIShell _vsUIShell;
- public GoToDefMouseHandler(IWpfTextView view, IOleCommandTarget commandTarget,
+ public GoToDefMouseHandler(IWpfTextView view, IOleCommandTarget commandTarget, IVsUIShell vsUIShell,
IClassifier aggregator, ITextStructureNavigator navigator, CtrlKeyState state)
{
_view = view;
_commandTarget = commandTarget;
+ _vsUIShell = vsUIShell;
_state = state;
_aggregator = aggregator;
_navigator = navigator;
@@ -315,6 +327,27 @@ namespace vdext15
_mouseDownAnchorPoint = null;
}
+ // Support backward/forward navigation via extended mouse buttons.
+ // Derived from https://github.com/tunnelvisionlabs/MouseNavigation/blob/master/Tvl.VisualStudio.MouseNavigation/MouseNavigationProcessor.cs.
+ public override void PostprocessMouseUp(MouseButtonEventArgs e)
+ {
+ if (_vsUIShell == null)
+ return;
+
+ uint cmdId;
+ if (e.ChangedButton == MouseButton.XButton1)
+ cmdId = (uint)VSConstants.VSStd97CmdID.ShellNavBackward;
+ else if (e.ChangedButton == MouseButton.XButton2)
+ cmdId = (uint)VSConstants.VSStd97CmdID.ShellNavForward;
+ else
+ return;
+
+ object obj = null;
+ _vsUIShell.PostExecCommand(VSConstants.GUID_VSStandardCommandSet97, cmdId,
+ (uint)OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref obj);
+
+ e.Handled = true;
+ }
#endregion |
Not exactly the same build as a release, but you can try the installer from https://ci.appveyor.com/project/rainers/visuald/builds/34611854/artifacts |
Thx! I've fortunately not yet uninstalled VS 2017 (installer wouldn't detect VS 2019), and the back/forward buttons work like a charm. |
That's the Appveyor build only, as it runs in a VS2017 environment and cannot build some components for VS2019. |
For a smooth out-of-the-box experience after something like: