Skip to content

Refined exuberant-ctags extension for Scala #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 22, 2013
Merged

Conversation

liancheng
Copy link
Contributor

The original ctags extension performs poorly when locating various tags, for example, here are some bad cases:

  • evaluator: the val substring in evaluator is parsed as the keyword val and a value tag named uator is generated.
  • private[this] class T: (case) classes/(case) objects/values/variables with access qualifiers are not recognized.
  • notaclass T: generates a wrong class tag T

The new extension refined all --regex-scala options to locate tags much more accurately, and added two new tag types, namely case-objects and packages.

* Refined --regex-scala options to locate tags much more accurately
* Added case-objects and packages tag types
@liancheng
Copy link
Contributor Author

Here are some test cases:

package emacs.contrib

private[this] abstract class PrivateAbstractClassWithAccessQualifier
abstract private[this] class AbstractPrivateClassWithAccessQualifier

private abstract class PrivateAbstractClass
abstract private class AbstractPrivateClass

sealed protected[contrib] class SealedProtectedClassWithAccessQualifier
protected[contrib] sealed class ProtectedSealedClassWithAccessQualifier

sealed protected class SealedProtectedClassWithAccessQualifier
protected sealed class ProtectedSealedClassWithAccessQualifier

implicit protected[contrib] object ImplicitProtectedObjectWithAccessQualifier
protected[contrib] implicit object ProtectedImplicitObjectWithAccessQualifier

protected case object ProtectedCaseObject
protected case class ProtectedCaseClass

protected[this] val intValWithType: Int = 1
protected[this] val intVal = 1

protected[this] var intVarWithType: Int = 1
protected[this] var intVar = 1

private[this] def unary_+(n: Int): Int

trait Trait
type Type

@adriaanm
Copy link
Contributor

Thanks! I'm really sorry we haven't gotten back to you sooner.
We're looking for someone to maintain this github repository, as we're kind of overloaded maintaining scala/scala itself. Please sign the Scala CLA online, confirm here, and I'll merge this ASAP.

@liancheng
Copy link
Contributor Author

I've signed the Scala CLA. Thanks for your effort!

@adriaanm
Copy link
Contributor

Thank you!

adriaanm added a commit that referenced this pull request Oct 22, 2013
Refined exuberant-ctags extension for Scala
@adriaanm adriaanm merged commit f43ec12 into scala:master Oct 22, 2013
@simonrad
Copy link

simonrad commented Jan 7, 2014

Hi @liancheng,
For some reason these regexes are not working for me. They generate no scala tags, even for the test cases you provided. It does work with the previous version of the regexes. I'm using Exuberant Ctags 5.8 installed via homebrew on Mac OS X.

@liancheng
Copy link
Contributor Author

Hi @simonrad, would you mind to elaborate how you configured your Exuberant Ctags? And here is a minimized version of my configuration, which works fine under both CentOS 6.4 and Ubuntu 12.04:

  1. Copy dot-ctags to $HOME/.ctags
  2. Install the taglist-plus Vim plugin
  3. Add these lines to .vimrc:
" Taglist Scala support
let tlist_scala_settings = 'scala;' .
                         \ 'p:packages;' .
                         \ 'a:abstract classes;' .
                         \ 'c:classes;' .
                         \ 'm:case classes;' .
                         \ 'o:objects;' .
                         \ 'M:case objects;' .
                         \ 't:traits;' .
                         \ 'T:types;' .
                         \ 'f:functions;' .
                         \ 'V:values;' .
                         \ 'v:variables'

With this configuration I can generate proper tags file and view tags in Vim. To generate tags file, only step 1 is needed. Hope to be helpful.

@mhamrah
Copy link

mhamrah commented Jan 30, 2014

I can't use the newer ctags with ctags 5.8 and vim either. Is taglist-plus required? My ctags file looks exactly like the ctags file in this repository. The original file works when recursively tagging via

ctags -R . --exclude=target --exclude=.git

when using the newer version of the ctags configuration, no .scala files indexed in the tags file.

@liancheng
Copy link
Contributor Author

Hey @mhamrah and @simonrad, sorry for not being helpful for such a long time. I wasn't able to reproduce this bug until I got a Mac and hit right the same issue. After some investigation it turned out that ctags under Mac OS X somehow doesn't recognize some POSIX extended regex syntax like \<, \> and \s. And it works for me after replacing them with [[:space:]], [[:<:]] and [[:>:]]. Will submit a PR for this.

@liancheng
Copy link
Contributor Author

@mhamrah @simonrad Here is the PR: #137

@mhamrah
Copy link

mhamrah commented Jul 11, 2014

Nice!

On Fri, Jul 11, 2014 at 6:47 PM, Cheng Lian [email protected]
wrote:

@mhamrah https://github.com/mhamrah @simonrad
https://github.com/simonrad Here is the PR: #137
#137


Reply to this email directly or view it on GitHub
#95 (comment).

@simonrad
Copy link

Awesome! Thank you.

liancheng pushed a commit to liancheng/scala-dist that referenced this pull request Jul 20, 2014
Minor: Put StoragePerfTester in org/apache/
liancheng pushed a commit to liancheng/scala-dist that referenced this pull request Jul 20, 2014
… on YARN docs

This patch changes "yarn-standalone" to "yarn-cluster" (but still supports the former).  It also cleans up the Running on YARN docs and adds a section on how to view logs.

Author: Sandy Ryza <[email protected]>

Closes scala#95 from sryza/sandy-spark-1197 and squashes the following commits:

563ef3a [Sandy Ryza] Review feedback
6ad06d4 [Sandy Ryza] Change yarn-standalone to yarn-cluster and fix up running on YARN docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants