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

Got <BV> to stop showing up in LMP deps #305

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

reecelikesramen
Copy link

@reecelikesramen reecelikesramen commented Oct 14, 2024

Fix for #287

  • culprit is Black formatter adds space after # comment
  • it doesn't always though because if the formatter raises exception, no format
  • fixed by chaning #<BV> => # <BV> but for all tags

NOTE: this might not be the right way since without rerunning all the LMPs, the old source persists in the DB, so the old # tags won't get rendered right in the React app. Could instead enforce that # becomes # even after formatting, or strip out the delimiter before formatting and add it back in after.

* culprit is Black formatter adds space after # comment
* it doesn't always though because if the formatter raises exception, no format
* fixed by chaning `#<BV>` => `# <BV>` but for all tags

NOTE: this might not be the right way since without rerunning all the LMPs, the old source persists in the DB, so the old #<BV> tags won't get rendered right in the React app. Could instead enforce that # <BV> becomes #<BV> even after formatting, or strip out the delimiter before formatting and add it back in after.
@reecelikesramen
Copy link
Author

Something else less important I noticed while working on this had to do with recognizing imports as dependencies. In __testing__.py one of my LMP's has an Optional[str] as a parameter type so it depends on from typing import Optional. However, in ell-studio that dependency resolves as from typing import _UnionGenericAlias probably due to how the lexical analysis works since Optional inherits from _UnionGenericAlias

@reecelikesramen
Copy link
Author

Before:
image
After:
image

In DiffRenderer.js just filtering these out of the code and previousCode:

function removeEllTags(code) {
  const ellTagRegex = /\s*#\s*<\/?(BV|BmV|LMP)>/g
  return code.replace(ellTagRegex, "")
}

code = removeEllTags(code)
previousCode = removeEllTags(previousCode)

}

code = removeEllTags(code);
previousCode = removeEllTags(previousCode);
Copy link
Owner

Choose a reason for hiding this comment

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

i think we dont want to remvoe tags. but if this is only for the diff renderer i guess thats fine ;)

@MadcowD
Copy link
Owner

MadcowD commented Oct 14, 2024

Okay this is great it works! :) nvm disregard prev comments id like to merge

@MadcowD MadcowD marked this pull request as ready for review October 14, 2024 15:05
@MadcowD MadcowD merged commit 5076621 into MadcowD:main Oct 14, 2024
3 checks passed
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