Mac OS X 有语法高亮编辑器组件吗

发布于 2024-08-25 22:53:08 字数 179 浏览 1 评论 0原文

我正在寻找一个语法突出显示组件,可以将其包含在 Mac OS X XCode 项目中,以允许编辑 Ruby、C++、Lua 等。

我需要一个开源组件或包含源代码的组件。

我的 Google 搜索根本没有找到太多关于 Mac OS X 框架或组件的信息,更不用说我正在寻找的类型了。

感谢您的指点!

I am looking for a syntax highlighting component that I can include in a Mac OS X XCode project to allow editing of Ruby, C++, Lua, etc.

I need a component that is open source or has the source included.

My Google searches didn't turn up much in the way of Mac OS X frameworks or components at all, let alone the type I am looking for.

Thanks for any pointers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

长亭外,古道边 2024-09-01 22:53:08

UKSyntaxColoredTextDocument(特定于 Mac)或 Scintilla(跨平台并在各种编辑器中使用,包括 Komodo)可能就是您正在寻找的。

UKSyntaxColoredTextDocument (Mac-specific) or Scintilla (cross-platform and in use in a variety of editors, including Komodo) might be what you're looking for.

如果没有 2024-09-01 22:53:08

您可以尝试使用 CodeMirror。我在我的 SQLite Professional 应用程序中执行此操作以突出显示用户可编辑的查询。设置起来也相当简单:

  1. 在您的项目中,将 CodeMirror 内容添加为文件夹而不是组。
  2. 将 WebKit.Framework 添加到您的项目中。
  3. 将 WebView 添加到您的 nib/xib。

添加以下代码:

// Load our webview from our local CodeMirror path
NSURL * url = [NSURL fileURLWithPath: [NSString stringWithFormat:@"%@/CodeMirror/Demo/preview.html", [[NSBundle mainBundle] resourcePath]]];

NSString * html = [NSString stringWithContentsOfURL: url encoding:NSUTF8StringEncoding error:nil];

[webView.mainFrame loadHTMLString: html baseURL: url];

他们还预定义了很多格式,因此效果很好。我发现的一个问题是,本机查找对话框在 WebView 上下文中不起作用。

You could try using CodeMirror. I do this in my SQLite Professional app to highlight user editable queries. It's also fairly simple to setup:

  1. In your project, add the CodeMirror contents as a Folder rather than a group.
  2. Add the WebKit.Framework to your project.
  3. Add a WebView to your nib/xib.

Add the following code:

// Load our webview from our local CodeMirror path
NSURL * url = [NSURL fileURLWithPath: [NSString stringWithFormat:@"%@/CodeMirror/Demo/preview.html", [[NSBundle mainBundle] resourcePath]]];

NSString * html = [NSString stringWithContentsOfURL: url encoding:NSUTF8StringEncoding error:nil];

[webView.mainFrame loadHTMLString: html baseURL: url];

They also have lots of formats pre-defined, so it works quite well. The one issue I have found with this, is that the native Find dialog does not work when in the context of the WebView.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文