Bug 361909 - add extra options to ctags command for project plugin
Summary: add extra options to ctags command for project plugin
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-17 20:13 UTC by Roberto Castagnola
Modified: 2016-04-24 10:16 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: Applications 16.04
Sentry Crash Report:


Attachments
read "ctags_options" key from project configuration as string list (2.62 KB, patch)
2016-04-17 20:20 UTC, Roberto Castagnola
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto Castagnola 2016-04-17 20:13:33 UTC
Should be nice to be able to add extra options to ctags command for some projects.

For example, in a my use case I have a bash project with some *.cfg files where I define "globals" variables that will be sourced by others scripts and that I would like to be indexed for completion, and some *.awk scripts that I want to exclude by indexing since I don't need awk functions outside their script.
In this example, my project looks like:

{
  "name": "Bash Project"
, "files": [{"directory": ".", "filters": ["*.sh", "*.profile", "*.func", "*.awk", "*.cfg"], "recursive": 1}]
, "ctags_options": [
    "--langdef=Cfg"
  , "--langmap=Cfg:.cfg\(*.profile\)"
  , "--regex-Cfg=/^[[:space:]]*((declare|local)[[:space:]]+(-[a-z]+[[:space:]]+))?([[:alpha:]][[:alnum:]]+(\\[[[:alnum:]]+])?)=/\\4/v,variables/"
  , "--exclude=*.awk"
  ]
}


Reproducible: Always
Comment 1 Roberto Castagnola 2016-04-17 20:20:30 UTC
Created attachment 98433 [details]
read "ctags_options" key from project configuration as string list

Patch for version 15.12.3

This is the patch I use to get the example into description working.
Anyway I think a better code may be wrote.
Comment 2 Dominik Haumann 2016-04-18 19:51:29 UTC
Hi Roberto,

could you please submit your patch at http://git.reviewboard.kde.org?

Also, I would like to change the json to:
{
    "name": "Bash Project"
  , "files": [{"directory": ".", "filters": ["*.sh", "*.profile", "*.func", "*.awk", "*.cfg"], "recursive": 1}]
  , "ctags": {
      options": [
           "--langdef=Cfg"
         , "--langmap=Cfg:.cfg\(*.profile\)"
         , "--regex-Cfg=/^[[:space:]]*((declare|local)[[:space:]]+(-[a-z]+[[:space:]]+))?([[:alpha:]][[:alnum:]]+(\\[[[:alnum:]]+])?)=/\\4/v,variables/"
         , "--exclude=*.awk"
      ]
    }
}

This allows us to easily extend the ctags section for future releases.
Comment 3 Roberto Castagnola 2016-04-19 19:20:15 UTC
(In reply to Dominik Haumann from comment #2)
> could you please submit your patch at http://git.reviewboard.kde.org?

Patch changed to match your requirements and submitted to http://git.reviewboard.kde.org
Review Request #127690

Hoping to have done it in the correct way.

Regards,
Roberto
Comment 4 Dominik Haumann 2016-04-24 10:12:21 UTC
Git commit 3bcd3d9c93d7af39ebce20f3dd275ad6dcac43fd by Dominik Haumann.
Committed on 24/04/2016 at 10:12.
Pushed by dhaumann into branch 'Applications/16.04'.

Projects plugin: allow ctags options

Thanks to Roberto Castagnola for the patch!
REVIEW: 127690

M  +26   -0    addons/project/kateproject.example
M  +7    -3    addons/project/kateprojectindex.cpp
M  +4    -2    addons/project/kateprojectindex.h
M  +2    -1    addons/project/kateprojectworker.cpp

http://commits.kde.org/kate/3bcd3d9c93d7af39ebce20f3dd275ad6dcac43fd