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

#136 Remove FollowSet cache dependency on ignoredTokens #149

Merged

Conversation

vityaman
Copy link
Contributor

@vityaman vityaman commented Aug 12, 2024

There is a problem explained at #136 (comment) because of cache dependency on ignoredTokens value. I just removed the token filter in getFollowingTokens. This logic originally was added in "Initial commit" 7 years ago, so motivation is unclear. On the one hand, tests were not changed, so the behavior with which all are agreed is the same. On the other hand, now we can get some elements of ignoredTokens in followSet from candidates. It can be fixed by simply adding a check after followSet was received either from the cache or computation.

@mike-lischke, there are two questions:

  1. Do we want to filter tokens in follow set?

If yes, then I'll do changes and this test case will be OK:

core = CodeCompletionCore(X)
follow = core.collectCandidates(Y).tokens[Z] 
assert follow == [A, B, C]

core = CodeCompletionCore(X)
core.ignoredTokens.add(B)
follow = core.collectCandidates(Y).tokens[Z] 
assert follow == [A, C] // on 5eaad7b it returns [A, B, C]
  1. Do we want to propagate this change to all ports (TypeScript, Java)?

@vityaman vityaman force-pushed the 136-port-cpp-cache-idempotence branch from 09ee945 to 60d72ef Compare August 12, 2024 09:41
@vityaman vityaman marked this pull request as ready for review August 12, 2024 10:03
@mike-lischke
Copy link
Owner

I see no reason why to remove a useful feature. OK, it's not a big thing, but it's something that makes usage a bit easier. The problem described in #136 seems not to be related to this filtering of unwanted tokens.

Signed-off-by: vityaman <vityaman.dev@yandex.ru>
Signed-off-by: vityaman <vityaman.dev@yandex.ru>
Signed-off-by: vityaman <vityaman.dev@yandex.ru>
Signed-off-by: vityaman <vityaman.dev@yandex.ru>
@vityaman vityaman force-pushed the 136-port-cpp-cache-idempotence branch from 2f26aaa to c1ad650 Compare August 26, 2024 05:55
@vityaman
Copy link
Contributor Author

@mike-lischke, returned following tokens filtering based on ignoredTokens. I placed it right after processRule inside collectCandidates to avoid caching dependent results.

Copy link
Owner

@mike-lischke mike-lischke left a comment

Choose a reason for hiding this comment

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

While I see the benefit of your changes, they will make it more difficult to incorporate future changes from the TS version (like bug fixes).

@mike-lischke mike-lischke merged commit e4e3480 into mike-lischke:main Aug 26, 2024
3 checks passed
@vityaman
Copy link
Contributor Author

@mike-lischke, if you are talking about this cache fix, I can make the same changes to Java and TypeScript versions of the library. Do we need it?

@mike-lischke
Copy link
Owner

No, no, that's not what I meant. I spoke about future changes in the TS version that would need to be tracked by the ports and the more the source code diverts, the harder it is to do that.

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