使 Xcode 更突出所选符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7333509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:53:52  来源:igfitidea点击:

Make Xcode highlight selected symbol more

xcode

提问by Tomas Andrle

Xcode underlines all occurrences of a symbol that the cursor is on. However, the underline doesn't exactly "pop out" in the source code. Is it possible to make Xcode highlight the background color of the symbol, like Eclipse does it? I can't find anything in the Preferences panel.

Xcode 会在光标所在的所有符号处加下划线。但是,下划线在源代码中并没有完全“弹出”。是否可以像 Eclipse 那样让 Xcode 突出显示符号的背景颜色?我在“首选项”面板中找不到任何内容。

Xcode:

代码:

Xcode

Xcode

Eclipse:

蚀:

Eclipse

蚀

回答by Vivian_S.O.

XCode already has this feature but there's a delay on it after you single clickon the text you want to highlight. You can set the delay to 0 seconds.

XCode 已经具有此功能,但在您单击要突出显示的文本后会出现延迟。您可以将延迟设置为 0 秒。

XCode > Preferences > TextEditing > HighlightInstancesOfSelected and set Delay to 0s

XCode > Preferences > TextEditing > HighlightInstancesOfSelected 并将延迟设置为 0s

This works but I wasn't able to change the color of it. It is a pale blue color and a bit hard to see.

这有效,但我无法更改它的颜色。它是一种淡蓝色,有点难以看到。

回答by Balazs Vadnai

Search for AutoHighlightSymbolin Alcatraz(Xcode's package manager). It will do exactly what you want.

搜索AutoHighlightSymbol恶魔岛(Xcode的包管理器)。它会做你想要的。

After you have the plugin installed, select Editor > Edit Highlight Color. This is transparent by default, so you have to pick one that suits your color theme best.

安装插件后,选择编辑器 > 编辑高光颜色。默认情况下这是透明的,因此您必须选择最适合您的颜色主题的颜色。

EDIT: Now that Alcatraz is gone, you're going to have to install the plugin manually. Download from their GitHub, build the project and restart Xcode - which needs to be unsigned for being able to load 3rd party bundles. More info on this here.

编辑:现在 Alcatraz 消失了,你将不得不手动安装插件。从他们的 GitHub下载,构建项目并重新启动 Xcode - 需要未签名才能加载 3rd 方包。更多信息在这里

回答by Zev Eisenberg

This is not exactly what you are looking for, but you may want to check out the PolychromaticXcode plugin (most easily installed via Alcatraz). It gives every symbol a unique color, which is used consistently throughout. So every instance of myVarmight be blue, and every instance of myOtherVarmight be red.

这并不完全是您要找的东西,但您可能想查看多色Xcode 插件(最容易通过Alcatraz安装)。它为每个符号赋予了独特的颜色,并贯穿始终。所以每个 的实例myVar可能是蓝色的,每个 的实例myOtherVar可能是红色的。

回答by Zev Eisenberg

This plugin does what you want. It's available through Alcatraz:

这个插件做你想做的。它可以通过Alcatraz 获得

https://github.com/keepyounger/HighlightSelectedString

https://github.com/keepyounger/HighlightSelectedString

回答by Mr.Fingers

community!

社区!

I have the same trouble and found something like that. (where the "currencyId" i select,another its work of plugin)

我有同样的麻烦,发现了类似的东西。(我选择的“currencyId”,另一个它的插件工作)

enter image description here

在此处输入图片说明

Its, i guess, do the same thing like [Cmd+E, Cmd+Fand Cmd+Gcombo] But its easier,you must only select word in your code.

它,我猜,做同样的事情 [ Cmd+ECmd+FCmd+G组合] 但它更容易,你必须只在你的代码中选择单词。

How to installit to Your XCode:

如何将其安装到您的 XCode:

  1. Launch XCode
  2. On top menu select Window->Package Manager
  3. In search type "highlightSelectedString" enter image description here
  4. Install it!
  5. ?

  6. Profit

  1. 启动 XCode
  2. 在顶部菜单上选择 Window->Package Manager
  3. 在搜索类型“ highlightSelectedString在此处输入图片说明
  4. 安装它!
  5. ?

  6. 利润

And also you can change colorof highlighting!!!

而且您还可以更改突出显示的颜色!!!

  1. go to Edit->Set Highlight color

  2. Choose your color

  1. 去编辑->设置高光颜色

  2. 选择你的颜色

回答by Emerald Weapon

I don't know if this is still relevant, but when you hover with the cursor on a symbol a small selection menu shows up and you can select "Edit All in Scope". This highlights all such symbols in a much more visible way. As the name suggests, this functionality is meant for a higher purpose, but I think it comes in handy even just for highlighting. I don't know if this feature was available before Xcode 5.

我不知道这是否仍然相关,但是当您将光标悬停在符号上时,会出现一个小选择菜单,您可以选择“编辑范围内的所有内容”。这以更明显的方式突出显示所有此类符号。顾名思义,这个功能是为了更高的目的,但我认为即使只是为了突出显示它也派上用场。我不知道这个功能在 Xcode 5 之前是否可用。

回答by raj

ok go to xcode select preferences pop over will come select fonts and colors down u can see 4 buttons,with 1 having name selection,click and choose any deep color

好的,转到 xcode 选择首选项弹出将选择字体和颜色向下你可以看到 4 个按钮,其中 1 个具有名称选择,单击并选择任何深色