@ApiStatus.Internal
  public @NotNull List<Pair<TextRange, TextAttributes>> getAttributesFor(@NotNull Document document, int offset, @NotNull CharSequence s) {
    var lexerWrapper = getLexerWrapper(StringUtil.replaceSubSequence(document.getImmutableCharSequence(), offset, offset, s), offset);
    int data;

    List<Pair<TextRange, TextAttributes>> result = new ArrayList<>();

    while (lexerWrapper.getTokenType() != null) {
      int lexerState = lexerWrapper.getState();
      data = mySegments.packData(lexerWrapper.getTokenType(), lexerState, canRestart(lexerState));
      if (lexerWrapper.getTokenEnd() > offset) {
        int start = Math.max(offset, lexerWrapper.getTokenStart());
        int end = Math.min(lexerWrapper.getTokenEnd(), offset + s.length());
        TextAttributes attributes = getAttributes(mySegments.unpackTokenFromData(data));
        result.add(Pair.create(TextRange.create(start, end), attributes));
      }
      if (lexerWrapper.getTokenEnd() >= offset + s.length()) break;
      lexerWrapper.advance();
    }

    return result;
  }
@ApiStatus.Internal
  public @NotNull List<Pair<TextRange, TextAttributes>> getAttributesFor(@NotNull Document document, int offset, @NotNull CharSequence s)