rokucommunity / brighterscript-formatter

A code formatter for BrighterScript (and BrightScript)
MIT License
14 stars 6 forks source link

White space not removed after dot notation #69

Closed chrisdp closed 3 months ago

chrisdp commented 1 year ago

notice the space between m. and flyoutItemHeight

m. flyoutItemHeight = (designSystem.tv.button.typography.label.normal).fontSize + (designSystem.tv.nav.padding.topBtm.flyoutItem * 2)

should format to:

m.flyoutItemHeight = (designSystem.tv.button.typography.label.normal).fontSize + (designSystem.tv.nav.padding.topBtm.flyoutItem * 2)
philanderson888 commented 9 months ago

Hello @chrisdp and @TwitchBronBron I might need a little help getting started on this one ... also I have a new computer now so I may need a refresh of the instructions to download all the repositories and get started; I have them all on my Windows machine but I have a new MAC as well and would like to use that as my main machine so if you do have those setup instructions that would be handy. Thanks.

TwitchBronBron commented 9 months ago

Here are the setup instructions: https://rokucommunity.github.io/vscode-brightscript-language/contributing.html#the-easy-way

However, for this issue, you should only need to work in BrighterScript-formatter repo. It has a full suite of unit tests, so you can add a new unit test with the thing you're trying to fix, and then dig around in this file. https://github.com/rokucommunity/brighterscript-formatter/blob/master/src/formatters/InteriorWhitespaceFormatter.ts

philanderson888 commented 9 months ago

@TwitchBronBron lovely, thanks

philanderson888 commented 9 months ago

getting

(node:25352) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit

during install ... although not sure if it's just a warning or an error ... seems like a warning ... so ignoring for now ...

TwitchBronBron commented 9 months ago

To do the tests, you can cd into the brighterscript-formatter folder and then run npm run test or run the "test" command from vscode.

philanderson888 commented 9 months ago

basic install has worked

Screenshot 2023-10-07 at 17 42 06

so that's a good start

philanderson888 commented 9 months ago

really interesting ... seems like MAC uses 'zsh' now by default and this was not playing ball; after trying for a while and manually I gave up on this.

switched to 'bash' as default shell.

also in VSCode switched shell to 'bash'

then the installs did seem to run although I had to add 'sudo'

sudo npm run install-local

also for the watcher as well it was not working without sudo

sudo npm run watch-all --loglevel silent
sudo npm run watch-webviews 

odd, anyway I think this is a MAC/npm permissions error rather than a problem with the scripts, not sure.

but after a lot of work , got the VSCode development host to run

Screenshot 2023-10-07 at 19 15 53

philanderson888 commented 9 months ago

also got the npm run tests to work


  197 passing (103ms)

=============================== Coverage summary ===============================
Statements   : 100% ( 595/595 )
Branches     : 100% ( 488/488 )
Functions    : 100% ( 58/58 )
Lines        : 100% ( 580/580 )
================================================================================

@TwitchBronBron

philanderson888 commented 9 months ago

seems like a quick

sudo chmod -R 777 RokuCommunity

fixed the permissions issues

philanderson888 commented 9 months ago

got a fix - will tidy it up and push for your observation @TwitchBronBron @chrisdp

philanderson888 commented 9 months ago

@chrisdp @TwitchBronBron please have a look at proposed changes

I know you have code which actually removes the next token if it is blank; I just set the easier option of setting current text to '' rather than removing the whole token. Please see if this works or not. Thanks.

https://github.com/rokucommunity/brighterscript-formatter/pull/78

TwitchBronBron commented 3 months ago

Fixed by #83