Skip to content
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

Pass lexer options to enumeration to support continue use case #267

Merged
merged 1 commit into from
May 28, 2015

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented May 23, 2015

There is no way to use the continue option in lexer.lex if the enumeration mode is used. This will be needed to support proper syntax highlighting when blocks of code are streamed and formatted.

@rumpelsepp
Copy link
Contributor

@jneen
Copy link
Member

jneen commented May 28, 2015

LGTM.

jneen added a commit that referenced this pull request May 28, 2015
Pass lexer options to enumeration to support continue use case
@jneen jneen merged commit 6e5c61f into rouge-ruby:master May 28, 2015
DouweM pushed a commit to gitlabhq/gitlabhq that referenced this pull request May 28, 2015
Fix git blame syntax highlighting when different commits break up lines

### What does this MR do?

This MR fixes a bug where syntax highlighting would not work properly in certain lines when doing a `git blame` view of a file. Also, this MR reuses the Rugments lexer and formatter for each `git blame` commit block, which should make things faster and reduce overhead.

### Why was this MR needed?

When doing a `git blame`, GitLab feeds the Rugments lexer/formatter blocks of code based on the latest commit for each line.  However, this can cause lexer to fail because the state is cleared between each block of code, which causes `highlight` to fallback to the plaintext lexer. For example, notice this unhighlighted line in [this file](https://gitlab.common-lisp.net/cmucl/cmucl/blame/master/src/assembly/assemfile.lisp):

![image](https://gitlab.com/gitlab-org/gitlab-ce/uploads/b403fe5c2b883882a9eeea7e0409c583/image.png)

The fixed version looks like this:

![image](https://gitlab.com/stanhu/gitlab-ce/uploads/32c4d7c8ff15a7d59b364dd988f7c657/image.png)

This MR requires a patch to rugments to allow the `continue` option to be passed to the lexer.

* https://github.com/rumpelsepp/rugments/pull/24
* https://github.com/rumpelsepp/rugments/pull/23
* Also submitted to rouge: rouge-ruby/rouge#267

### What are the relevant issue numbers?

Closes #1521

See merge request !697
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.

3 participants