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

[Bug]: java rainbow highlighting not working #31

Closed
jay-babu opened this issue Aug 22, 2023 · 9 comments
Closed

[Bug]: java rainbow highlighting not working #31

jay-babu opened this issue Aug 22, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@jay-babu
Copy link

Neovim version

0.9.1

Language affected

Java

Query

No response

Strategy

No response

Description

package com.transformity.pos.util;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Utils {
  public static String toUpperCamelCase(String input) {
    String[] words = input.split("\\s+");
    StringBuilder result = new StringBuilder();
    for (String word : words) {
      if (!word.isEmpty()) {
        String capitalizedWord =
            word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase();
        result.append(capitalizedWord);
      }
    }
    return result.toString();
  }

  public static BigDecimal calculateProfitMargin(BigDecimal sellPrice, BigDecimal buyPrice) {
    if (sellPrice == null || buyPrice == null) {
      return null;
    }
    try {
      return ((sellPrice.subtract(buyPrice)).divide(buyPrice, RoundingMode.HALF_UP))
          .multiply(BigDecimal.valueOf(100));
    } catch (ArithmeticException e) {
      return null;
    }
  }

  public static int calculateBuyRangeImportance(String buyRange) {
    if (buyRange == null) {
      return -1;
    }
    return switch (buyRange) {
      case "PRICE INCREASE" -> 100;
      case "BUY 30", "BUY 60", "BUY 90", "BUY 120", "BUY 150" -> 90;
      default -> 0;
    };
  }
}
@jay-babu jay-babu added the bug Something isn't working label Aug 22, 2023
@jay-babu
Copy link
Author

alacritty_My723eFkBs

@HiPhish
Copy link
Owner

HiPhish commented Aug 23, 2023

Works for me. Do you have the Tree-sitter grammar installed? What does checkhealth rainbow-delimiters display?

Screenshot_20230823_185139

@jay-babu
Copy link
Author

==============================================================================
rainbow-delimiters: require("rainbow-delimiters.health").check()

- ERROR The healthcheck report for "rainbow-delimiters" plugin is empty.

@HiPhish
Copy link
Owner

HiPhish commented Aug 23, 2023

Looks like the plugin did not install properly for you. Can you please try uninstalling and installing it again? If that does not work, can you please post the directory contents of your local copy? You can use the tree command to print a nice directory tree.

@jay-babu
Copy link
Author

https://gist.github.com/jay-babu/787c7376f0b058f1ca51c26df4a5bc1d. I uninstalled and installed and the same error came up again

@HiPhish
Copy link
Owner

HiPhish commented Aug 24, 2023

That's weird. Which version of Neovim are you running? Are you somehow lazy-loading this plugin?

@jay-babu
Copy link
Author

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

I was lazy loading, but just tried without it. the same problem

@jay-babu
Copy link
Author

I am using the lazy plugin manager

@HiPhish
Copy link
Owner

HiPhish commented Aug 27, 2023

Does the problem still persist on the current master? Are languages other
than Java affected? If you :edit the buffer again does it work then?

As for the health check, we can compare hash values. Here is the SHA-256 of my
file:

5e78ec80c7c62699d0309bc646142922ed1e24224fcfd5a8eeb0866a80ab5a01  lua/rainbow-delimiters/health.lua

If yours differs then there is something wrong with your file.

jay-babu added a commit to jay-babu/astrocommunity that referenced this issue Jan 5, 2024
addresses: AstroNvim#672

currently rainbow-delimiters do not load properly unless `:e` is run in the document. using VeryLazy event, it loads properly. I don't fully understand this, but I believe loading the file first then having rainbow-delimiters load causes it to not color everything properly. HiPhish/rainbow-delimiters.nvim#31 (comment). the `:e` fix seems to be known by the author
@jay-babu jay-babu closed this as completed Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants