-
Notifications
You must be signed in to change notification settings - Fork 57
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
space-indicator first draft #360
Conversation
Thanks @lpjjj1222! Is this a draft PR, or a final proposal? Given that you're aware of least one bug, it should be marked a draft. For drafts, I want to know what feedback you're looking for. Are there questions you have, things you want me to review, things I should ignore? |
No reply, converting to draft. I'll review it as a draft. |
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.
Thanks for getting started on this enhancement! It's a good start. Here are things to resolve before its ready for release:
- There shouldn't be any changes to
package-lock.json
; usenpm ci
to sync dependencies, notnpm update
. Revert those changes in the PR. - Remove the
console.log
s insrc/routes/layout.svelte
,Setting.ts
,Mode.svelte
, andSpace.svelte
- Add placeholders for the new string in the other locales; see
npm run locales
to verify you have resolved all of the missing string errors. - Yes, there is a defect in
Space.svelte
. In the else case of thespaceIndicator
check, there's no non-breaking space being inserted to represent the space, only a tab. The return statement should be refactored to reuse the else case of theexplicit
check, so that it only renders the explicit space ifexplicit
andspaceIndicator
is true, and render a non-breaking space if not. - Use the locale's labels for the mode descriptions in
Settings.svelte
, not hard coded-English labels. - The name of
spaceIndicator
inSpace.svelte:render
shadows the importedspaceIndicator
. Rename to avoid confusion. - Remove the unused imports in
Space.svelte
Apologies for the delayed response, I've just seen your comment:( |
I followed your advice and ran npm run locales, and there was an error in en-US: /ui/dialog/settings/mode: must NOT have additional properties. When I opened the file, I found that the error was caused by a new 'space' property that I had added, following the structure of the 'dark' property. However, there was a warning on 'space' indicating that this property is not allowed. I asked ChatGPT4 for help, and it suggested that the error might be due to other files that use en-US.json having certain expectations about its structure. In the 'Settings.svelte' file, I used BTW, I tried to find all the files related to en-US.json using a global search, but it was challenging because the files are nested... Could you offer any assistance? |
Hi @lpjjj1222. ChatGPT doesn't know anything about this code base, it's not a good resource. The definition of what properties are allowed are defined in I can elaborate further if you have more questions! |
Thank you Professor Amy. However, I discovered that even after declaring 'space' in the UITexts.ts, the 'this property is not allowed' is still there :( |
@lpjjj1222 Ah, when you modify the locale definitions, you also need to run |
@amyjko Hi Professor Amy, I have follow your suggestions and modify my code but I still have some problems:
So I opened the locale file and discovered that there indeed are some ‘&?’ to be replaced by translation. I am not sure is it related to the issue I am working on. If not, should I just ignore them?
Thank you so much Professor Amy😭 |
Thanks for the update @lpjjj1222!
|
Hi Professor Amy @amyjko , thank you for telling me how does Space.svelte works. I 've been solving the problem that the user's coding input that has already existed is not being correctly re-rendered when the space indicator is toggled. ![]() And then, I toggle the space indicator, make it closed. It shows like: Then, if I type a space or a random letter in the bracket, '·' that are outside the bracket still exists, however, if I type a random letter or space outside the bracket, everything behaves well, all of '·' disappear. I tried console.log to see eg. in the case of screenshot, Could you give me more help to proceed with this problem? |
Hi @lpjjj1222. I think I know what's happening. There's actually quite a bit of undocumented behavior around reactivity in Svelte with whitespace changes in spans. For example, see this issue: I worked around that behavior by wrapping the rendering block in a All of this is a bit of a hack, but necessary because of this gap in reactivity in Svelte. A notes reminders about other things to fix:
|
Hi @amyjko. Thank you for your guidance! It seems that I've already solve the re-render issue. |
Yes, that's adequate for removing them. There are still a few differences visible, but they are minor. In general, undoing a commit is complicated: https://stackoverflow.com/questions/2938301/remove-specific-commit Let me know when you're ready for another review. |
Hi@amyjko If there are any additional adjustments needed, I'm on standby to make further updates. Looking forward to your feedback! |
Thanks! When you think a PR is ready for review, convert it from a draft PR to ready for review. That way I know you want me to review it, and it makes it eligible to merge. |
@amyjko I have converted it to be ready for review. Looking forward to your feedback~ |
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.
This is great progress! It's getting very close. A few things that I think still need improvement:
- There are unused imports that need to be removed in
Space.svelte
- I think the check mark icon in the settings shouldn't be one with the black background, since the x does not have a black background, for consistency.
- Precede the Spanish and Chinese space indicator label with a
$!
to flag them for review by the locale teams, just to make sure the translations make sense - The English tooltip labels for the settings are "open" and "closed" which are not descriptive of what the setting actually does. They should be something like "show space and tab indicators explicitly" and "do not show space and tab indicators". These need to teach creators what the effect of the setting change will be, especially since the change is not visible when the dialog is covering the editor.
I think that's it, then it will be ready for deployment! Congrats on getting this far.
@amyjko |
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.
I think this is ready for production. Congratulations on a successful PR!
Working Process:
To design a SpaceSetting similar to DarkSetting:
Already Implemented:
bug:
There seems to be a bug when typing spaces... I suspect it may be related to insertionIndex, beforeSpaces, afterSpaces, additionalSpaces, or related issues in space.svelte