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

Add support for Java #1

Merged
merged 13 commits into from
Dec 22, 2023
Merged

Add support for Java #1

merged 13 commits into from
Dec 22, 2023

Conversation

jssblck
Copy link
Member

@jssblck jssblck commented Oct 27, 2023

Overview

Adds support for Java snippet extraction and refactors the library a bit.

Acceptance criteria

Users can extract Java function snippets from source code.

Testing plan

Covered well by automated tests; I ran those.

Risks

None

References

https://fossa.atlassian.net/browse/ANE-1293

Checklist

  • I added tests for this PR's change (or explained in the PR description why tests don't make sense).

@jssblck jssblck marked this pull request as ready for review November 28, 2023 02:43
@jssblck jssblck requested review from a team and meghfossa and removed request for a team November 28, 2023 02:43
/// Common functionality for any type indicating a section of bytes to extract from [`Content`].
pub trait ByteCoordinate {
/// The byte offset at which the function starts.
fn byte_start(&self) -> usize;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Optional] use https://doc.rust-lang.org/std/ops/struct.Range.html instead, to get start <= x and start <= end guarantee


use crate::include_str_lf;

// #[test]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Prefer] Let's kill dead comments or add one-two line explaining why we are keeping this test commented!

import java.util.HashMap;
import java.util.logging.Logger;

public class TestFunctions {
Copy link

@meghfossa meghfossa Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Optional, Minor] Let's add interface, so it's explicitly part of our test scenario.

@@ -0,0 +1,9 @@
//! Higher level parsers and constants on top of tree-sitter primitives.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Optional] Let's add doc url, on where we are getting these symbol tag names. I think they are coming from vendored node-types.json, according to: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types

@jssblck jssblck merged commit fda3a84 into main Dec 22, 2023
10 checks passed
@jssblck jssblck deleted the java branch December 22, 2023 01:41
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.

2 participants