[Lldb-commits] [PATCH] D149565: [lldb] Add debugger.external-editor setting

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Apr 30 19:42:45 PDT 2023


mib added inline comments.


================
Comment at: lldb/include/lldb/Core/Debugger.h:298
 
+  llvm::StringRef GetExternalEditor() const;
+  bool SetExternalEditor(llvm::StringRef editor);
----------------
newline


================
Comment at: lldb/source/Host/macosx/objcxx/Host.mm:395-396
 
-  static std::optional<FSRef> g_app_fsref;
-  static std::string g_app_error;
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, [&]() {
-    if (const char *external_editor = ::getenv("LLDB_EXTERNAL_EDITOR")) {
-      LLDB_LOG(log, "Looking for external editor: {0}", external_editor);
-
-      FSRef app_fsref;
-      CFCString editor_name(external_editor, kCFStringEncodingUTF8);
-      long app_error = ::LSFindApplicationForInfo(
-          /*inCreator=*/kLSUnknownCreator, /*inBundleID=*/NULL,
-          /*inName=*/editor_name.get(), /*outAppRef=*/&app_fsref,
-          /*outAppURL=*/NULL);
-      if (app_error == noErr) {
-        g_app_fsref = app_fsref;
-      } else {
-        g_app_error =
-            llvm::formatv("could not find external editor \"{0}\": "
-                          "LSFindApplicationForInfo returned error {1}",
-                          external_editor, app_error)
-                .str();
+  if (const char *lldb_external_editor = ::getenv("LLDB_EXTERNAL_EDITOR")) {
+    if (!editor.empty()) {
+      if (editor != llvm::StringRef(lldb_external_editor)) {
----------------
Should we even check for the env variable is the user set the editor setting ?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149565/new/

https://reviews.llvm.org/D149565



More information about the lldb-commits mailing list