wojciech-kulik / xcodebuild.nvim

Neovim plugin to Build, Debug, and Test applications created for Apple devices (iOS, macOS, watchOS, etc.)
MIT License
638 stars 16 forks source link

How to find location of errors #181

Open John-Colvin opened 1 day ago

John-Colvin commented 1 day ago

The xcode "Issue navigator" pre-emptively finds problems in the whole project - without me manually running a build - then lets me click on one of those problems and get taken to the relevant line & column.

My current experience using xcodebuild.nvim is that I can trigger a build, I get the error logs, but a) the summary shows a line number but not the file the error came from (it is visible above, but it does make the summary a bit useless) & b) I can't trivially "go to error location".

Note, I am not a neovim wizard yet, perhaps this is just in the category of "learn to write your own lua code to implement whatever you want", but perhaps I'm just missing some config.

wojciech-kulik commented 1 day ago

Hi,

There are two types of errors:

  1. Errors detected by LSP and LSP can detect errors only in open buffers (not sure if only in visible ones). Those errors will be highlighted in a source code without building. You can also browse them using any plugin that supports it like :Telescope diagnostics, :Trouble diagnostics. You can also use a built-in mechanism: :lua vim.diagnostic.setqflist() to see them on quickfix list.
  2. There are build errors that you can get from build logs and they will be detected in the whole source code (but keep in mind that sometimes an error in one place causes that the other place won't be built, so you won't see next errors until you fix the first one). When you build the project, the plugin parses errors and puts them in a quickfix list, so that you can navigate between errors across the whole source code. You can see those errors using :Telescope quickfix, :Trouble quickfix or built-in :cl.

If your logs are missing file, that's either because it's some global error and there is no file in logs or it's a bug in parser and it's unable to detect the filename. You can post this part of original logs (your proj/.nvim/xcodebuild/original_logs.txt) with the error + your summary and I will check what's wrong.

John-Colvin commented 1 day ago
CompileC /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/Objects-normal/arm64/splatLoader-ca0ef9096c7798832298a2a1de2e61a7.o /Users/john/Git/Wyrd/splat-ply/splatLoader.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Aurora' from project 'Aurora')
    cd /Users/john/Git/Wyrd/aurora/iOS

    Using response file: /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/Objects-normal/arm64/82b82416624d2658e5098eb0a28c15c5-common-args.resp

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -ivfsstatcache /Users/john/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphoneos18.0-22A3362-8ec3fe4dca91fa9a941eaa2d5faad0e4.sdkstatcache -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fno-color-diagnostics -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/john/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wquoted-include-in-framework-header -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Index.noindex/DataStore @/Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/Objects-normal/arm64/82b82416624d2658e5098eb0a28c15c5-common-args.resp -O3 -MMD -MT dependencies -MF /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/Objects-normal/arm64/splatLoader-ca0ef9096c7798832298a2a1de2e61a7.d --serialize-diagnostics /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/Objects-normal/arm64/splatLoader-ca0ef9096c7798832298a2a1de2e61a7.dia -c /Users/john/Git/Wyrd/splat-ply/splatLoader.cpp -o /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/Objects-normal/arm64/splatLoader-ca0ef9096c7798832298a2a1de2e61a7.o -index-unit-output-path /Aurora.build/Debug-iphoneos/Aurora.build/Objects-normal/arm64/splatLoader-ca0ef9096c7798832298a2a1de2e61a7.o
/Users/john/Git/Wyrd/splat-ply/splatLoader.cpp:55:23: error: expected ';' after return statement
   55 |         return nullptr
      |                       ^
      |                       ;
1 error generated.

ProcessInfoPlistFile /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Products/Debug-iphoneos/Aurora.app/Info.plist /Users/john/Git/Wyrd/aurora/iOS/Aurora/Info.plist (in target 'Aurora' from project 'Aurora')
    cd /Users/john/Git/Wyrd/aurora/iOS
    builtin-infoPlistUtility /Users/john/Git/Wyrd/aurora/iOS/Aurora/Info.plist -producttype com.apple.product-type.application -genpkginfo /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Products/Debug-iphoneos/Aurora.app/PkgInfo -expandbuildsettings -format binary -platform iphoneos -additionalcontentfile /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/Launch\ Screen-SBPartialInfo.plist -additionalcontentfile /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/SPOpen-CoreMLPartialInfo.plist -additionalcontentfile /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/assetcatalog_generated_info.plist -scanforprivacyfile /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Products/Debug-iphoneos/Aurora.app/ZIPFoundation_ZIPFoundation.bundle -requiredArchitecture arm64 -o /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Products/Debug-iphoneos/Aurora.app/Info.plist

note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Aurora' from project 'Aurora')
** BUILD FAILED **

The following build commands failed:
    CompileC /Users/john/Library/Developer/Xcode/DerivedData/Aurora-gdchitfyfeljzkfvjpvilqyshapc/Build/Intermediates.noindex/Aurora.build/Debug-iphoneos/Aurora.build/Objects-normal/arm64/splatLoader-ca0ef9096c7798832298a2a1de2e61a7.o /Users/john/Git/Wyrd/splat-ply/splatLoader.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Aurora' from project 'Aurora')
    Building project Aurora with scheme Aurora
(2 failures)
[Aurora] Compiling splatLoader.cpp
[x] /Users/john/Git/Wyrd/splat-ply/splatLoader.cpp:55:23: expected ';' after return statement
   55 |         return nullptr
      |                       ^
[Aurora] Processing Info.plist

-----------------------------
-- xcodebuild.nvim summary --
-----------------------------

Errors:
  ✖ expected ';' after return statement
       55 |         return nullptr
          |                       ^

  Build Failed

See that the filename is there in the first print-out but not in the second.

wojciech-kulik commented 1 day ago

Ok, I know why it happens. This plugin does not support other files than swift files. Maybe I could make an exception in case of build errors. I will check it out.