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

[status-bar & tree-view] Manual Decaf Source #707

Merged
merged 7 commits into from
Sep 8, 2023

Conversation

confused-Techie
Copy link
Member

Alright, here's the long awaited last decaf PR for the foreseeable future.

In this PR I've gone ahead and decaffed the source of:

  • status-bar
  • tree-view

But it feels important to mention the decaf here is light, partly because that's why most decaf PRs have gone so smoothly, but this light work is especially present in tree-view/lib/tree-view.js. This file is 1,593 lines long, with some complex logic behind it. And rather than attempt significant decaf work, which 1. I feel would have to warrant a thorough review of this code and 2. has a very likely chance of causing breaking changes in this section of the codebase, I've instead opted to leave it nearly untouched, even so far as leaving behind the decaffination tips, for whoever in the future plans to refactor this file, which is severely needed, but as such a PR would have a significantly smaller scope, it feels much more achievable there, than it does here.

(So if someone in the future, is using git blame to find out why this file is such a mess, sorry about that)


Otherwise this PR is just like all other decaf work, the diff will temporarily be using the base branch machine-decaf-source until such a time as all tests are passing, and hopefully with a review, then the branch will be changed to master making the diff unreadable.

Resolves #444

@confused-Techie
Copy link
Member Author

So in the body of the PR I've described how much of a complex mess tree-view.coffee was, and that I did very little decaf work at risk of breaking things.

It seems we found one of the few files where it truly matters the exact version of CoffeeScript is being used. That means I had to redecaf tree-view.coffee using exactly CoffeeScript 1.12.7 (The version Pulsar uses currently internally during runtime) or else the package would break.

This unfortunately means that the file has become even less readable as a result, and now at it's 2,049 line long self, I'm even more inclined to leave this cleanup to a future refactor, one where this file is essentially the only purpose of the PR, otherwise testing and diffs become nearly impossible to fully understand.

All I've done to this file is add back in comments, and that's it. (Since this version of CoffeeScript drops comments entirely)

@confused-Techie
Copy link
Member Author

Alright, as we have done with all other decaf PRs, tests here are happy, I'll go ahead and change the main branch over.

@confused-Techie confused-Techie changed the base branch from machine-decaf-source to master September 8, 2023 04:01
@confused-Techie
Copy link
Member Author

Alright, with happy tests, gonna go ahead and merge this one!

@confused-Techie confused-Techie merged commit 4e55d8c into master Sep 8, 2023
@confused-Techie confused-Techie deleted the manual-decaf-source branch September 8, 2023 05:16
@DeeDeeG
Copy link
Member

DeeDeeG commented Sep 14, 2023

👍 on this PR in general, as per all the decaf PR's generally.

But I think this PR did upset the "documentation" GitHub Actions workflow over on master branch.
https://github.com/pulsar-edit/pulsar/actions/runs/6117983762/job/16605413592

$ jsdoc2md --files src --configure docs/.jsdoc.json > ./docs/Pulsar-API-Documentation.md
JSDOC_ERROR: ERROR: The @example tag requires a value. File: tree-view.js, line: 1730
ERROR: The @example tag requires a value. File: tree-view.js, line: 1738

Just noting it, I can try and help fixing it once I get some other things out of the way, backlog items, etc.

@confused-Techie
Copy link
Member Author

@DeeDeeG Good catch on that, yeah I didn't notice.

I believe this stems from tree-view.js Line 1734. Where we turned the following comment:

  # Public: Return an array of paths from all selected items
  #
  # Example: @selectedPaths()
  # => ['selected/path/one', 'selected/path/two', 'selected/path/three']
  # Returns Array of selected item paths

Into:

  /**
     * @memberof TreeView
     * @function selectedPaths
     * @desc Public: Return an array of paths from all selected items
     * @example
     * @selectedPaths() => ['selected/path/one', 'selected/path/two', 'selected/path/three' ]
     * @returns {array} Selected item paths
     */

And if I had to guess, while this is valid, and attempts to represent the same exact comment, since the comment comes from coffeescript where the @ within the code meant to reference this using that same exact comment below the line @example makes JSDoc think we are instead attempting to declare another tag. So we should probably fix this to change the line below @example to:

/** 
* this.selectedPaths() => ['selected/path/on', 'selected/path/two', 'selected/path/three']
*/

And that will likely resolve the error.

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.

Finish Decaffing all core packages
2 participants