-
Notifications
You must be signed in to change notification settings - Fork 328
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
TextEdit with custom IdMap #10283
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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
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 |
There was a problem hiding this 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- remove
public
and makeprivate
- 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)]) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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. */ |
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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?
Pull Request Description
close #10182
Changelog:
text/applyEdit
requestTreeToIR
parsing stepImportant Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.