Skip to content

Instantly share code, notes, and snippets.

@xhujerr
Last active March 11, 2021 14:33
Show Gist options
  • Save xhujerr/bb21b8b9ff3d43fd9da7babc2e152eba to your computer and use it in GitHub Desktop.
Save xhujerr/bb21b8b9ff3d43fd9da7babc2e152eba to your computer and use it in GitHub Desktop.
Quick how to rebuild Kate Symbol Viewer Plugin

Kate Symbol Viewer Plugin: Parse groovy Parse groovy files with the parseCppSymbols() - same as Java

Parse groovy files with the parseCppSymbols() - same as Java

Motivation

I would like to have Symbols for my groovy files, but file type groovy is not supported:

Groovy Symbols

What I found out is that if I rename my file from cfn.groovy to cfn.java the symbol viewer works just flawlessly: Java Symbols

Preparation

Building Kate from Sources on Linux

sudo apt install cmake
sudo apt install ninja-build
sudo apt install libkf5i18n-dev
sudo apt install libkf5doctools-dev
sudo apt install libkf5texteditor-dev
sudo apt install libkf5newstuff-dev
sudo apt install libkf5threadweaver-dev
sudo apt install libkf5crash-dev libkf5activities-dev
sudo apt install libqt5widgets-dev
sudo apt install qt5widgets-dev
sudo apt install qtbase5-dev

kdesrc-build --initial-setup

My kdesrc-buildrc looks like this:

global
    branch-group kf5-qt5
    cmake-options -G "Kate - Ninja"
    compile-commands-export yes
    compile-commands-linking yes
    kdedir ~/../GIT/kde/usr
    source-dir ~/../GIT/kde/src
    build-dir ~/../GIT/kde/build
end global

options kate
  branch release/19.12
end options

include ~/../GIT/kdesrc-build/kf5-frameworks-build-include
include ~/../GIT/kdesrc-build/kf5-applications-build-include
include ~/../GIT/kdesrc-build/kf5-workspace-build-include
include ~/../GIT/kdesrc-build/kf5-extragear-build-include

Building

first build vanilla master (that will fetch kate sources):
kdesrc-build --no-include-dependencies kate

find the file to change:
find /home/GIT -name plugin_katesymbolviewer.cpp

then navigate to kate repo
cd /home/GIT/kde/src/kde/applications/kate

checkout appropriate branch:
git checkout release/19.12 and make the changes

the rebuild without fetching from remote:
kdesrc-build --no-include-dependencies --no-src kate

Hacky replace

Locate the upstream plugin binary:
dpkg -L kate | grep plugin

Locate the compiled plugin
find /home/GIT -name katesymbolviewerplugin.so

Backup the original plugin:
sudo mv /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/katesymbolviewerplugin.so /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/katesymbolviewerplugin.so.bak

Override the existing plugin:
sudo cp ./usr/lib/x86_64-linux-gnu/plugins/ktexteditor/katesymbolviewerplugin.so /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/katesymbolviewerplugin.so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment