You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand the reasons for #fileID as it is, but if I want to jump to the location of an assertion, seeing the result of #fileID in a diagnostic is pretty unhelpful in a large project. I'll append the emacs-lisp code it takes for me to (hackily) get to the line (in most cases). I hope you'll agree this is pretty horrible. Users of IDEs other than Xcode will have to do similar things. I don't care at all about the size of my binaries during development, and ideally I'd like debug builds to include the full #filePath in assertions, but it might be better to just have a command-line option for this.
(defundwa/path-tails-matching (pathpaths)
"Returns the elements of PATHS with PATH as their suffix, matching by path component."
(let ((tail (file-name-concat "/" path)))
(seq-filter (lambda (full-path) (string-suffix-p tail full-path)) paths)))
(defundwa/compilation-parse-errors-filename-in-project (path-in-error)
"If PATH-IN-ERROR is found in the filesystem, returns itunchanged; otherwise tries to return a unique file in the currentproject likely to be identified by PATH-IN-ERROR. ReturnsPATH-IN-ERROR unchanged if no such file can be found."
(if (file-exists-p path-in-error) path-in-error
;; First look for relative path suffixes.
(let* ((candidates (project-files (project-currentt)))
(full-matches (dwa/path-tails-matching path-in-error candidates)))
;; If not found, try just the filename component of;; path-in-error; Swift assertions are weird and include a;; module name that doesn't necessarily correspond to anything in the;; filesystem.
(cond ((null full-matches)
(let ((filename-matches
(dwa/path-tails-matching (file-name-nondirectory path-in-error) candidates)))
(cond ((null filename-matches) path-in-error)
;; unique match; return it
((null (cadr filename-matches)) (car filename-matches))
;; multiple matches; consider prompting for the user to select one.
(t path-in-error))))
;; unique match; return it
((null (cadr matches)) (car matches))
; multiple matches; consider prompting for the user to select one.
(t path-in-error)))))
(setq compilation-parse-errors-filename-function 'dwa/compilation-parse-errors-filename-in-project)
The text was updated successfully, but these errors were encountered:
Since #fileID needs a specific machine-parseable format, perhaps a better solution would be to have the offending functions use #file instead (once that defaults to equalling #fileID.) Then, you can toggle #file back to equalling #filePath in your local configuration.
Here is a horrible workaround I came up with: use an SPM plugin to generate a file containing an internal version of all the standard library functions that use #fileID, in each target.
I understand the reasons for
#fileID
as it is, but if I want to jump to the location of an assertion, seeing the result of#fileID
in a diagnostic is pretty unhelpful in a large project. I'll append the emacs-lisp code it takes for me to (hackily) get to the line (in most cases). I hope you'll agree this is pretty horrible. Users of IDEs other than Xcode will have to do similar things. I don't care at all about the size of my binaries during development, and ideally I'd like debug builds to include the full#filePath
in assertions, but it might be better to just have a command-line option for this.The text was updated successfully, but these errors were encountered: