protected override void CaptureExtraProperties(ProjectProperties projProperties, IMacroEvaluator evaluator) { ThreadHelper.ThrowIfNotOnUIThread(); if (projProperties == null) { return; } OutputLog.Log("Capturing Extra configuration from Unreal..."); //Basic VS context Document doc = EditorUtils.GetActiveDocument(); Project project = EditorUtils.GetActiveProject(); //Find module path & name for the given file string modulePath = GetModulePath(doc.FullName); string moduleName = modulePath == null ? null : Path.GetFileName(modulePath); OutputLog.Log(moduleName == null ? "Unable to find Unreal Engine Module." : "Unreal Engine Module Name: " + moduleName); //Open project vcxproj as xml //Find the first .cpp file from the given module & steal its configuration AppendFileConfiguration(projProperties, SearchInProjectFile(project, modulePath), evaluator); //Add basic preprocessor definition projProperties.PrepocessorDefinitions.Add("UNREAL_CODE_ANALYZER"); }
private DocumentLocation GetCurrentLocation() { ThreadHelper.ThrowIfNotOnUIThread(); Document activeDocument = EditorUtils.GetActiveDocument(); if (activeDocument == null) { return(null); } //Get text location var textManager = EditorUtils.ServiceProvider.GetService(typeof(SVsTextManager)) as IVsTextManager2; if (textManager == null) { return(null); } IVsTextView view; textManager.GetActiveView2(1, null, (uint)_VIEWFRAMETYPE.vftCodeWindow, out view); if (view == null) { return(null); } view.GetCaretPos(out int line, out int col); return(new DocumentLocation(activeDocument.FullName, (uint)(line + 1), (uint)(col + 1))); }
public override string ComputeMacro(string macroStr) { ThreadHelper.ThrowIfNotOnUIThread(); if (macroStr == @"$(UE4ModuleName)") { Document doc = EditorUtils.GetActiveDocument(); if (doc == null) { return(null); } string modulePath = ExtractorUnreal.GetModulePath(doc.FullName); if (modulePath == null) { return(null); } string moduleName = Path.GetFileName(modulePath); OutputLog.Log("UE4 Module Name: " + moduleName); return(moduleName); } return(null); }
public override ProjectProperties GetProjectData() { ThreadHelper.ThrowIfNotOnUIThread(); OutputLog.Log("Capturing configuration from CMake..."); Document document = EditorUtils.GetActiveDocument(); if (document == null) { return(null); } var evaluator = new MacroEvaluatorCMake(); var customSettings = SettingsManager.Instance.Settings; string commandsFile = customSettings == null ? null : customSettings.CMakeCommandsFile; commandsFile = commandsFile == null ? null : evaluator.Evaluate(commandsFile); if (commandsFile == null || commandsFile.Length == 0) { var activeConfig = GetActiveConfiguration(); if (activeConfig != null) { var cmakeArgsEvaluator = new MacroEvaluatorCMakeArgs(); commandsFile = cmakeArgsEvaluator.Evaluate(activeConfig.buildRoot); if (commandsFile.Length > 0) { char lastchar = commandsFile[commandsFile.Length - 1]; if (lastchar != '\\' && lastchar != '/') { commandsFile += '\\'; } commandsFile += "compile_commands.json"; } } } var ret = CaptureCMakeCommands(commandsFile, document.FullName); AddCustomSettings(ret, evaluator); return(ret); }