Git Product home page Git Product logo

sctags's Introduction

SCTags is ctags and etags extractor for Scala language. It will fallback to ctags if language other than Scala was forced

Usage

sctags [-f|-o file] [-R|--recurse] [--list-languages] [--version] <files>

-f file | -o file
  sets the file the tags are written to, default is "tags"
  (Use "-" for standard output)

-R --recurse
  recurse through directories specified on the command line

--list-languages
  list the supported languages (inlcuding the ctags suported ones)

--language-force=lang
  it will fall back to ctags if the lang is not Scala

--version
  print fake version for exhuberant ctags compatibility

Build, Install and Running

$ sbt assembly
$ cp target/scala-2.11/sctags ~/bin

The executable uncludes the compiled classes. It will look for the scala libraries relatively to the scala executable that should be on your $PATH. Other option is to set SCALA_HOME to the root of your Scala distribution or SCALA_LIB to the lib directory of SCALA_HOME.

Example Vim + TagBar config

function! SCTags()
    if executable("sctags")
        let g:tagbar_ctags_bin = "sctags"
        let g:tagbar_type_scala = {
            \ 'ctagstype' : 'scala',
            \ 'sro'       : '.',
            \ 'kinds'     : [
                \ 'p:packages',
                \ 'V:values',
                \ 'v:variables',
                \ 'T:types',
                \ 't:traits',
                \ 'o:objects',
                \ 'O:case objects',
                \ 'c:classes',
                \ 'C:case classes',
                \ 'm:methods:1'
            \ ],
            \ 'kind2scope'  : {
                \ 'p' : 'package',
                \ 'T' : 'type',
                \ 't' : 'trait',
                \ 'o' : 'object',
                \ 'O' : 'case_object',
                \ 'c' : 'class',
                \ 'C' : 'case_class',
                \ 'm' : 'method'
            \ },
            \ 'scope2kind'  : {
                \ 'package' : 'p',
                \ 'type' : 'T',
                \ 'trait' : 't',
                \ 'object' : 'o',
                \ 'case_object' : 'O',
                \ 'class' : 'c',
                \ 'case_class' : 'C',
                \ 'method' : 'm'
            \ }
        \ }
    endif
endfunction

if has("autocmd")
    autocmd FileType scala call SCTags()
endif

This will give you nice package/class/object/method hierarchy in Tagbar. Here is an example:

▼+types : package
  ▼+Membership : trait
     +C[T] : type
     +T : type
     +contains(a:C[T], b:T) : method
  ▼+BloomFilterMembership : class
     +T : type
     +<init>() : method
     +contains(a:BloomFilter[T], b:T) : m
  ▼+MinMaxMembership : class
     +T : type
     +<init>() : method
     +contains(a:MinMax[T], b:T) : metho
  ▼+SetMembership : class
     +T : type
     +<init>() : method
     +contains(a:Set[T], b:T) : method
  ▼+MembershipOps : object
    ▼+Contained : class
       +C[T] : type
       +T : type
        [values]
       -a
       -tc
       +<@(b:C[T]) : method
       +<init>(a:T)(tc:Membership[T, C])

Copyright

This package is based on http://programmer-monk.net/darcs/repos/sctags

It is simplified and extended to support scope tracking.

Released under the Apache 2.0 License.

Copyright 2008 Geoff Reedy

Copyright 2015 Luben Karavelov

sctags's People

Contributors

luben avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.