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

TextEdit with custom IdMap #10283

Merged
merged 7 commits into from
Jun 15, 2024
Merged

Conversation

4e6
Copy link
Contributor

@4e6 4e6 commented Jun 13, 2024

Pull Request Description

close #10182

Changelog:

  • add: IdMap parameter to the text/applyEdit request
  • add: IdMap to the runtime module
  • update: set IdMap during the interactive compilation
  • update: set the IR identifiers in the TreeToIR parsing step

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.

@4e6 4e6 added the CI: No changelog needed Do not require a changelog entry for this PR. label Jun 13, 2024
@4e6 4e6 self-assigned this Jun 13, 2024
@4e6 4e6 marked this pull request as ready for review June 14, 2024 09:10
Copy link
Collaborator

@hubertp hubertp left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@hubertp hubertp left a comment

Choose a reason for hiding this comment

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

What if the IdMap becomes really big? I don't image we want to send it then on every request, especially not in JSON

@4e6
Copy link
Contributor Author

4e6 commented Jun 14, 2024

Currently, the IdMap in the file is replaced and not updated. In the future we can add a parameter that will only include the updated values

@4e6 4e6 added the CI: Ready to merge This PR is eligible for automatic merge label Jun 15, 2024
@mergify mergify bot merged commit 04a92ef into develop Jun 15, 2024
37 checks passed
@mergify mergify bot deleted the wip/db/10182-remove-expression-uuids branch June 15, 2024 18:03
Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

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

Is it ensured (and tested) that modules with extra IdMap aren't cached?

this.idMap = Collections.emptyMap();
}

public TreeToIr(Map<Location, UUID> idMap) {
Copy link
Member

Choose a reason for hiding this comment

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

  • remove public and make private
  • create a factory method
  • remove MODULE constant and use the factory method

*
* @param values the list of span-uuid pairs
*/
case class IdMap(values: Vector[(Span, UUID)])
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have Pair of Pair and UUID when the protocol talkes about tripple?

@@ -86,6 +88,8 @@ void initializeBuiltinsIr(

CharSequence getCharacters(Module module) throws IOException;

IdMap getIdMap(Module module);
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need this method, when there also is:

public abstract IdMap getIdMap();

on the Module itself? Looks like unnecessary duplication.

import org.enso.compiler.core.ir.Location;

/** A mapping between the code {@link Location}s and their identifiers. */
public record IdMap(Map<Location, UUID> values) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a special IdMap record instead of directly using the Map?

import java.util.UUID;
import org.enso.compiler.core.ir.Location;

/** A mapping between the code {@link Location}s and their identifiers. */
Copy link
Member

Choose a reason for hiding this comment

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

Why don't se use @ExternalId annotation like elsewhere, @hubertp?

* @tparam A the source type
*/
case class Changeset[A](
source: A,
ir: IR,
simpleUpdate: Option[SimpleUpdate],
invalidated: Set[UUID @ExternalID]
invalidated: Set[UUID @ExternalID],
Copy link
Member

Choose a reason for hiding this comment

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

Here we use @ExternalID - why it is not used everywhere in the new code, @hubertp?

hubertp added a commit that referenced this pull request Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove expression UUIDs from metadata section of a source file
3 participants