-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: Support for TypeHierachy + CallHierarchy #612
Conversation
@InSyncWithFoo you can test this PR with your ls (see explanation at https://github.com/redhat-developer/lsp4ij?tab=readme-ov-file#testing-the-ci-builds) It is working by default with TEXT and textmate language. If you do Ctrl+Alt+H, it should execute the call hierarchy. Here a sample with python: If you have a custom language, you need to declare <callHierarchyProvider
language="YourLanguage"
implementationClass="com.redhat.devtools.lsp4ij.features.callHierarchy.LSPCallHierarchyProvider" /> I have tested with the python code: def calculate_subtotal(order):
"""
Calculates the subtotal of the order.
:param order: Dictionary with items and their prices.
:return: Subtotal.
"""
subtotal = sum(order.values())
print(f"Calculated subtotal: {subtotal} €")
return subtotal
def apply_discount(subtotal, discount):
"""
Applies a discount to the subtotal.
:param subtotal: Amount before the discount.
:param discount: Discount percentage (0 to 100).
:return: Amount after discount.
"""
discounted_amount = subtotal * (1 - discount / 100)
print(f"Discount applied ({discount}%): {discounted_amount} €")
return discounted_amount
def calculate_tax(amount, tax_rate):
"""
Calculates the tax on an amount.
:param amount: Amount to which tax is applied.
:param tax_rate: Tax rate percentage (e.g., 20 for 20%).
:return: Tax amount.
"""
tax = amount * (tax_rate / 100)
print(f"Tax calculated ({tax_rate}%): {tax} €")
return tax
def calculate_total(order, discount, tax_rate):
"""
Calculates the total amount including discount and tax.
:param order: Dictionary with items and their prices.
:param discount: Discount percentage.
:param tax_rate: Tax rate percentage.
:return: Total amount.
"""
subtotal = calculate_subtotal(order)
discounted_amount = apply_discount(subtotal, discount)
tax = calculate_tax(discounted_amount, tax_rate)
total = discounted_amount + tax
print(f"Total amount: {total} €")
return total
# Example usage
if __name__ == "__main__":
order_example = {
"Burger": 10.99,
"Fries": 4.50,
"Drink": 2.00
}
discount_rate = 10 # 10% discount
tax_rate = 20 # 20% tax
total_amount = calculate_total(order_example, discount_rate, tax_rate)
print(f"Final total: {total_amount} €") |
@InSyncWithFoo please give me feedback. I would like tointegrate in 0.8.0 since bydefault it is working with TEXT and textmate language (no impact for other languages). |
I'm in the middle of publishing a long-awaited release, so I'll be testing the build and giving you feedbacks on Monday. |
Ok thanks. After doing a lot of tests, it seems it is working good. I need to write docs and after that I will merge my PR. If you have time to test it is nice otherwise I will create the release on monday. |
429bfa1
to
af58724
Compare
Signed-off-by: azerr <[email protected]>
af58724
to
fda321d
Compare
Another test with go:
|
feat: Support for TypeHierachy + CallHierarchy