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

Fix: Return None in find_word_in_line when word is not found #467

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

islml
Copy link

@islml islml commented Mar 6, 2025

This PR addresses a TODO in the find_word_in_line function, which suggested that returning None when the word is not found would make more sense than returning a Range(-1, -1).

I modified find_word_in_line to return None when the word is not found as suggested, and updated find_word_in_code_line to handle the None return value

@islml islml requested a review from gnikit as a code owner March 6, 2025 23:40
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.31%. Comparing base (f7c3ecd) to head (fc9a7f5).

Files with missing lines Patch % Lines
fortls/parsers/internal/parser.py 60.00% 2 Missing ⚠️
fortls/langserver.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #467      +/-   ##
==========================================
- Coverage   88.33%   88.31%   -0.03%     
==========================================
  Files          35       35              
  Lines        4800     4808       +8     
==========================================
+ Hits         4240     4246       +6     
- Misses        560      562       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@islml
Copy link
Author

islml commented Mar 7, 2025

Changes:

  1. Updated the validate_def function to handle the case where the Range is None.
  2. Updated the _create_ref_link method to handle the case where find_word_in_code_line returns None.
  3. Updated the build method in the Diagnostic class to handle the case where obj_range is `None.

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.

1 participant