KDevelop 4.2.2语法突出问题
KDevelop 4.2.2 syntax highlighting questions
对于我的C++开发,我在Ubuntu Natty上运行KDevelop,我有两个问题:
1) 它以随机彩虹色突出显示了我的所有变量——我该如何改变?我希望我所有的变量都是浅蓝色的。
2) 函数的颜色总是紫色,我该如何更改?
如果有人知道答案,我将不胜感激。
谢谢!!
这两个问题的答案都很简单:目前你做不到。
您可以确保所有变量都以相同的颜色高亮显示,但此颜色将为黑色,无法更改。转到
设置->配置KDevelop…->语言支持
并确保在Semantic Code Highlighting
部分中,Local Colorization Intensity
和Global Colorization Intensity
都设置为零(即向左滑动滑块)。
然而,你为什么想要这个?就我个人而言,我发现为每个变量选择不同的颜色非常方便。它可以让您非常容易地发现特定变量的所有出现。
是的。。。源代码相当"差"。。。有许多硬编码的值没有更改它们的选项。。。幸运的是,它是开源的;)
我遇到了同样的问题:我同意,彩虹色在某些方面增加了可读性,但就我个人而言,它分散了我的注意力…所以我对kdevplatform:做了这个补丁
diff -aur -x '*.user' -x CMakeFiles kdevplatform-1.7.0-o/language/highlighting/colorcache.cpp kdevplatform-1.7.0-n/language/highlighting/colorcache.cpp
--- kdevplatform-1.7.0-o/language/highlighting/colorcache.cpp 2014-08-26 19:49:48.000000000 +0000
+++ kdevplatform-1.7.0-n/language/highlighting/colorcache.cpp 2014-10-23 19:50:37.667559094 +0000
@@ -43,37 +43,38 @@
#define ifDebug(x)
-// ######### start interpolation
+//// ######### start interpolation
-uint totalColorInterpolationStepCount = 6;
-uint interpolationWaypoints[] = {0xff0000, 0xff9900, 0x00ff00, 0x00aaff, 0x0000ff, 0xaa00ff};
-//Do less steps when interpolating to/from green: Green is very dominant, and different mixed green tones are hard to distinguish(and always seem green).
-uint interpolationLengths[] = {0xff, 0xff, 0xbb, 0xbb, 0xbb, 0xff};
-
-uint totalGeneratedColors = 10;
-
-uint totalColorInterpolationSteps()
-{
- uint ret = 0;
- for(uint a = 0; a < totalColorInterpolationStepCount; ++a)
- ret += interpolationLengths[a];
- return ret;
-}
-
-///Generates a color from the color wheel. @param step Step-number, one of totalColorInterpolationSteps
-QColor interpolate(uint step)
-{
- uint waypoint = 0;
- while(step > interpolationLengths[waypoint]) {
- step -= interpolationLengths[waypoint];
- ++waypoint;
- }
-
- uint nextWaypoint = (waypoint + 1) % totalColorInterpolationStepCount;
-
- return KColorUtils::mix( QColor(interpolationWaypoints[waypoint]), QColor(interpolationWaypoints[nextWaypoint]),
- float(step) / float(interpolationLengths[waypoint]) );
-}
+//uint totalColorInterpolationStepCount = 6;
+//uint interpolationWaypoints[] = {0xff0000, 0xff9900, 0x00ff00, 0x00aaff, 0x0000ff, 0xaa00ff};
+////Do less steps when interpolating to/from green: Green is very dominant, and different mixed green tones are hard to distinguish(and always seem green).
+//uint interpolationLengths[] = {0xff, 0xff, 0xbb, 0xbb, 0xbb, 0xff};
+
+//uint totalGeneratedColors = 10;
+
+//uint totalColorInterpolationSteps()
+//{
+// uint ret = 0;
+// for(uint a = 0; a < totalColorInterpolationStepCount; ++a)
+// ret += interpolationLengths[a];
+// return ret;
+//}
+
+/////Generates a color from the color wheel. @param step Step-number, one of totalColorInterpolationSteps
+
+//QColor interpolate(uint step)
+//{
+// uint waypoint = 0;
+// while(step > interpolationLengths[waypoint]) {
+// step -= interpolationLengths[waypoint];
+// ++waypoint;
+// }
+
+// uint nextWaypoint = (waypoint + 1) % totalColorInterpolationStepCount;
+
+// return KColorUtils::mix( QColor(interpolationWaypoints[waypoint]), QColor(interpolationWaypoints[nextWaypoint]),
+// float(step) / float(interpolationLengths[waypoint]) );
+//}
// ######### end interpolation
namespace KDevelop {
@@ -144,6 +145,7 @@
m_defaultColors = new CodeHighlightingColors(this);
m_colors.clear();
+ /*
uint step = totalColorInterpolationSteps() / totalGeneratedColors;
uint currentPos = m_colorOffset;
ifDebug(kDebug() << "text color:" << m_foregroundColor;)
@@ -152,6 +154,7 @@
ifDebug(kDebug() << "color" << a << "interpolated from" << currentPos << " < " << totalColorInterpolationSteps() << ":" << (void*) m_colors.last().rgb();)
currentPos += step;
}
+ */
m_validColorCount = m_colors.count();
m_colors.append(m_foregroundColor);
}
它删除了生成的颜色,因此变量现在实际上是黑色的(前景色)。
对于2),当前版本似乎尊重kate语法颜色(不确定)。
在Archlinux上,我也做了这个PKGBUILD:
pkgname=kdevplatform-no-rainbow-highlight
_pkgname=kdevplatform without rainbow colors highlighting
pkgver=1.7.0
_pkgver=4.7.0
pkgrel=2
pkgdesc="A C/C++ development platform for KDE"
arch=('i686' 'x86_64')
url="http://www.kdevelop.org/"
license=('GPL')
provides=('kdevplatform')
conflicts=('kdevplatform')
depends=('kdelibs' 'subversion' 'qjson')
optdepends=("kdesdk-kompare: difference checking")
makedepends=('cmake' 'automoc4' 'boost')
install="${_pkgname}.install"
source=("http://download.kde.org/stable/kdevelop/${_pkgver}/src/${_pkgname}-${pkgver}.tar.xz"
"no-rainbow-color.patch"
)
sha1sums=('9fc196e7cb09ab33fd5cfbf5af19aa7c513efdc9'
'bed3c7e470a6a5a56bf1611e0effd7b8a8761e33')
prepare() {
cd ${_pkgname}-${pkgver}
patch -p1 -i ${srcdir}/no-rainbow-color.patch
cd ${srcdir}
mkdir build
}
build() {
cd build
cmake ../${_pkgname}-${pkgver}
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_SKIP_RPATH=ON
-DCMAKE_BUILD_TYPE=Release
make
}
package() {
cd build
make DESTDIR="${pkgdir}" install
}
不要去掉不同颜色的变量,你会问自己过去没有它是怎么做的。
相关文章:
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- 算法问题:查找从堆栈中弹出的所有序列
- 当我尝试添加 2 个大字符串时,我无法弄清楚出了什么问题
- 奇怪的代码抛出编译错误模板< J,int aSize=10> C2143:语法错误:在"<"之前缺少";"
- 阶乘问题在 c++ 中给出错误的输出
- C++泛型类错误,问题出在哪里?
- C++:取消引用十六进制值,有点语法问题
- 任何人都可以告诉我我的 C++ 代码出了什么问题?
- 数组为此合并排序函数提供了正确的输出,但向量给出了不正确的输出.出了什么问题?
- reinterpret_cast,只读访问,简单的可复制类型,会出什么问题?
- 在Hackerearth上获取运行时错误(SIGSEGV),无法找出代码中的问题
- 不确定出了什么问题(字符串输入)
- 我无法找出我的代码出了什么问题
- 我想知道变焦和轨道在哪里出了问题
- 我的C++级数计算程序出了什么问题?被困了好几个星期
- Rand() 没有显示随机数,请帮助我了解出了什么问题:)
- 向量<对<双精度,双精度>>给出问题
- 服务器未收到UDP数据包,花费数小时试图找出问题所在
- C++ 输出找出问题
- 在成功运行10小时后,在发布模式下从windows应用程序中获得异常,如何检测出问题