从 XCode 4.2 外部跳转到文件和行
对于 NSLogger 项目,我们希望实现直接跳回 XCode 到发出日志条目的文件中的行的功能。人们会期望使用这样的命令行工具很容易做到这一点:
xed --line 100 ~/work/xyz/MainWindowController.m
但这会导致意外错误:
2011-10-31 17:37:36.159 xed[53507:707] 错误:错误 Domain=NSOSStatusErrorDomain Code=-1728“该操作无法 完全的。 (OSStatus 错误 -1728。)”(例如:说明符要求 第 3 个,但只有 2 个。基本上,这表示运行时 分辨率错误。 ) UserInfo=0x40043dc20 {ErrorNumber=-1728, ErrorOffendingObject=}
另一个想法是使用 AppleScript 告诉 XCode 执行所需的步骤,但我无法找到可行的解决方案。
因此,任何能够达到预期效果的解决方案都将非常感激。
参考 GitHub 上的 NSLogger 问题:https://github.com/fpillet/NSLogger/issues/30
For the NSLogger project we would like to implement the feature to directly jump back to XCode to the line in the file that issued the log entry. One would expect thatthis would be easy using the command line tool like this:
xed --line 100 ~/work/xyz/MainWindowController.m
But this results in an unexpected error:
2011-10-31 17:37:36.159 xed[53507:707] Error: Error
Domain=NSOSStatusErrorDomain Code=-1728 "The operation couldn’t be
completed. (OSStatus error -1728.)" (e.g.,: specifier asked for the
3rd, but there are only 2. Basically, this indicates a run-time
resolution error. ) UserInfo=0x40043dc20 {ErrorNumber=-1728,
ErrorOffendingObject=}
Another idea is to use AppleScript to tell XCode to do the desired steps, but I was not able to find a working solution.
So any solution to reach the desired effect would be very appreciated.
Reference to the NSLogger Issue on GitHub: https://github.com/fpillet/NSLogger/issues/30
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
xed
工具似乎工作正常:错误
上面的错误只是表明请求的行超出范围。
解决方案
在执行
xed
之前检查行号是否确实存在。快速编写的示例
注意
确保正确计算行数:
计算文本行数
The
xed
tool seems to be working fine:Error
The error above simply indicates that the requested line is out of range.
Solution
Check wether the line number actually exists before executing
xed
.Quickly written example
Note
Make sure to count the number of lines correctly:
Counting Lines of Text