diff --git a/README.md b/README.md index 93b6598..c1aeaf1 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ Currently supported features: * Shows tree with project source files * Can open and edit source files from project or file system in multi-tab editor * Build and run project with DUB -* Build log highlight and navigation to place of error or warning by clicking on log line +* Build log highlight and navigation to place of error or warning by clicking on log line (contributed by Extrawurst) * DUB dependencies update -* DUB package configuration selection (implemented by NCrashed) +* DUB package configuration selection (contributed by NCrashed) * Dependency projects are shown in workspace tree Source editor features: diff --git a/src/ddc/lexer/tokenizer.d b/src/ddc/lexer/tokenizer.d index 34bbc27..04a6bf9 100644 --- a/src/ddc/lexer/tokenizer.d +++ b/src/ddc/lexer/tokenizer.d @@ -2596,8 +2596,16 @@ class Tokenizer for (;;) { int i = _pos; int endPos = int.max; + bool lastBackSlash = false; for(; i < _len; i++) { - if (_lineText[i] == delimiter && (i == 0 || _lineText[i - 1] != '\\')) { + dchar ch = _lineText[i]; + if (ch == '\\') { + if (lastBackSlash) + lastBackSlash = false; + else + lastBackSlash = true; + } + if (ch == delimiter && !lastBackSlash) { endPos = i; break; } diff --git a/src/ddebug/windows/mago.d b/src/ddebug/windows/mago.d index 4e5aa1b..48e3aab 100644 --- a/src/ddebug/windows/mago.d +++ b/src/ddebug/windows/mago.d @@ -9,6 +9,11 @@ import std.string; //const GUID CLSID_MAGO = {0xE348A53A, 0x470A, 0x4A70, [0x9B, 0x55, 0x1E, 0x02, 0xF3, 0x52, 0x79, 0x0D]}; const GUID IID_MAGO_NATIVE_ENGINE = {0x97348AC0, 0x2B6B, 0x4B99, [0xA2, 0x45, 0x4C, 0x7E, 0x2C, 0x09, 0xD4, 0x03]}; +//const GUID CLSID_PORT_SUPPLIER = {0x3484EFB2, 0x0A52, 0x4EB2, [0x86, 0x9C, 0x1F, 0x7E, 0x66, 0x8E, 0x1B, 0x87]}; +//const GUID CLSID_PORT_SUPPLIER = {0x3B476D38, 0xA401, 0x11D2, [0xAA, 0xD4, 0x00, 0xC0, 0x4F, 0x99, 0x01, 0x71]}; //3B476D38-A401-11D2-AAD4-00C04F990171 +const GUID CLSID_PORT_SUPPLIER = {0x708C1ECA, 0xFF48, 0x11D2, [0x90, 0x4F, 0x00, 0xC0, 0x4F, 0xA3, 0x02, 0xA1]}; //{708C1ECA-FF48-11D2-904F-00C04FA302A1} +//const GUID CLSID_PORT_SUPPLIER = {0xF561BF8D, 0xBFBA, 0x4FC6, [0xAE, 0xA7, 0x24, 0x45, 0xD0, 0xEA, 0xC1, 0xC5]}; +//const GUID CLSID_PORT_SUPPLIER = {0x708C1ECA, 0xFF48, 0x11D2, [0x90, 0x4F, 0x00, 0x04, 0xA3, 0x2, 0xA1]}; class ComObject : IUnknown { @@ -69,6 +74,46 @@ class DebugCallback : ComObject, IDebugEventCallback2 { } +string formatHResult(HRESULT hr) { + switch(hr) { + case S_OK: return "S_OK"; + case S_FALSE: return "S_FALSE"; + case E_NOTIMPL: return "E_NOTIMPL"; + case E_NOINTERFACE: return "E_NOINTERFACE"; + case E_FAIL: return "E_FAIL"; + case E_HANDLE: return "E_HANDLE"; + case 0x80040154: return "REGDB_E_CLASSNOTREG"; + default: + return format("%08x", hr); + } +} + +IDebugPortSupplier2 createPortSupplier() { + HRESULT hr; + IDebugPortSupplier2 portSupplier = null; + LPOLESTR str; + StringFromCLSID(&CLSID_PORT_SUPPLIER, &str); + hr = CoCreateInstance(&CLSID_PORT_SUPPLIER, //CLSID_MAGO, + null, + CLSCTX_INPROC, //CLSCTX_ALL, + &IID_IDebugPortSupplier2, //IID_MAGO_NATIVE_ENGINE, + cast(void**)&portSupplier); //piUnknown); + if (FAILED(hr) || !portSupplier) { + Log.e("Failed to create port supplier ", formatHResult(hr)); + return null; + } + Log.i("Port supplier is created"); + return portSupplier; +} + +class DebugPortRequest : ComObject, IDebugPortRequest2 { + static const wchar[] portName = "magoDebuggerPort\0"; + HRESULT GetPortName(/+[out]+/ BSTR* pbstrPortName) { + pbstrPortName = cast(BSTR*)portName.ptr; + return S_OK; + } +} + void testMago() { HRESULT hr; IUnknown* piUnknown; @@ -76,11 +121,30 @@ void testMago() { IDebugEngineLaunch2 debugEngineLaunch = null; hr=CoInitialize(null); // Initialize OLE if (FAILED(hr)) { - Log.e("OLE 2 failed to initialize"); + Log.e("OLE 2 failed to initialize", formatHResult(hr)); + return; + } + + IDebugPortSupplier2 portSupplier = createPortSupplier(); + if (!portSupplier) { + Log.e("Failed to create port supplier"); + return; + } + if (portSupplier.CanAddPort() != S_OK) { + Log.e("Cannot add debug port ", portSupplier.CanAddPort()); + return; + } + IDebugPort2 debugPort = null; + DebugPortRequest debugPortRequest = new DebugPortRequest(); + // Add a port + hr = portSupplier.AddPort( + /+[in]+/ debugPortRequest, + /+[out]+/ &debugPort); + if (FAILED(hr) || !debugPort) { + Log.e("Failed to create debub port ", formatHResult(hr)); return; } - IDebugCoreServer2 coreServer = null; //hr = CoCreateInstance(&CLSID_MAGO, null, CLSCTX_ALL, &IID_IDebugEngine2, cast(void**)&piUnknown); hr = CoCreateInstance(&IID_MAGO_NATIVE_ENGINE, //CLSID_MAGO, @@ -92,7 +156,7 @@ void testMago() { Log.d("Debug interface is not null"); } if (FAILED(hr) || !debugEngine) { - Log.e("Failed to create MAGO interface instance ", hr); + Log.e("Failed to create MAGO interface instance ", formatHResult(hr)); return; } @@ -103,7 +167,7 @@ void testMago() { hr = debugEngine.QueryInterface(cast(GUID*)&IID_IDebugEngineLaunch2, cast(void**)&debugEngineLaunch); if (FAILED(hr) || !debugEngineLaunch) { - Log.e("Failed to get IID_IDebugEngineLaunch2 interface ", hr); + Log.e("Failed to get IID_IDebugEngineLaunch2 interface ", formatHResult(hr)); return; } @@ -139,7 +203,7 @@ void testMago() { ); if (FAILED(hr) || !process) { - Log.e("Failed to run process ", format("%08x", hr)); + Log.e("Failed to run process ", formatHResult(hr)); return; } Log.d("LaunchSuspended executed ok"); diff --git a/src/dlangide/workspace/project.d b/src/dlangide/workspace/project.d index 5728c43..5dc712f 100644 --- a/src/dlangide/workspace/project.d +++ b/src/dlangide/workspace/project.d @@ -480,7 +480,7 @@ class Project : WorkspaceItem { if (!selectionsFile.load()) return false; Setting versions = selectionsFile.objectByPath("versions"); - if (!versions) + if (!versions.isObject) return false; string[string] versionMap = versions.strMap; foreach(packageName, packageVersion; versionMap) {