Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

OutlineView style the list of functions#2854

Merged
jasonLaster merged 4 commits into
masterfrom
feature/2562-outlineview-style-the-list-of-functions
May 10, 2017
Merged

OutlineView style the list of functions#2854
jasonLaster merged 4 commits into
masterfrom
feature/2562-outlineview-style-the-list-of-functions

Conversation

@codehag
Copy link
Copy Markdown
Contributor

@codehag codehag commented May 9, 2017

Associated Issue: #2562

Summary of Changes

This is the styling ticket for the OutlineList view, which introduces a function list for a given file

  • style the list of functions
  • jump to the source location

Test Plan

How to test:

  • After starting the app and navigating to localhost:8000, click on the "settings" in the sidebar, and make sure that the "Source Outline" feature is enabled.
  • launch a browser and open a debugger from localhost:8000
  • click through the source tree until you reach a .js file
  • you should see an outline at the bottom

this needs a few more things like integrations tests

Here's the Debugger's Testing doc
https://docs.google.com/document/d/1oBMRxV8A2ag2t22YsQOxTdEv0mXKzIg0tggJjRkU1S0/edit#.
Feel free to improve it!

Screenshots/Videos (OPTIONAL)

screen shot 2017-05-09 at 6 27 12 pm

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2017

Codecov Report

Merging #2854 into master will increase coverage by 0.12%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2854      +/-   ##
==========================================
+ Coverage   58.57%   58.69%   +0.12%     
==========================================
  Files          63       63              
  Lines        2356     2380      +24     
  Branches      484      487       +3     
==========================================
+ Hits         1380     1397      +17     
- Misses        976      983       +7
Impacted Files Coverage Δ
src/components/shared/previewFunction.js 100% <100%> (ø) ⬆️
src/components/Outline.js 83.78% <100%> (+3.78%) ⬆️
src/test/tests-setup.js 70.83% <0%> (-29.17%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b4dd0b...37de205. Read the comment docs.

@codehag codehag changed the title Feature/2562 outlineview style the list of functions outlineview style the list of functions May 9, 2017
@codehag codehag changed the title outlineview style the list of functions [WIP] outlineview style the list of functions May 9, 2017
Comment thread src/components/Outline.js
return functions
.filter(func => func.value != "anonymous")
.map(this.renderFunction);
.map(func => this.renderFunction(func));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this change make any difference ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Either approach is fine. We're generally prefer function references when there are no paramsmap(this.renderFunction), but we don't lint for it and either is fine.

Copy link
Copy Markdown
Contributor Author

@codehag codehag May 9, 2017

Choose a reason for hiding this comment

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

yes, it binds the this value. I just took a look through a few of the other files though and I noticed that doing the binding in the constructor is more common... would that be a clearer way of writing it?

ie)

constructor(props) {
  super(props);
  this.renderFunction = this.renderFunction.bind(this)
}

Copy link
Copy Markdown
Contributor

@jasonLaster jasonLaster left a comment

Choose a reason for hiding this comment

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

Couple comments, but looking great!

Comment thread src/components/Outline.js Outdated
}

selectItem(location) {
const selectedSourceId = this.props.selectedSource.get("id");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

generally we destructure our props so that it is clear what our this deps are in the func

const {selectedSource, selectSource} = this.props;

Comment thread src/components/Outline.js
return functions
.filter(func => func.value != "anonymous")
.map(this.renderFunction);
.map(func => this.renderFunction(func));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Either approach is fine. We're generally prefer function references when there are no paramsmap(this.renderFunction), but we don't lint for it and either is fine.

Comment thread src/components/tests/Outline.js Outdated
};
const startLine = 12;

symbolDeclarations.functions[0] = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

perhaps we also have a generateSymbolDeclaration factory as well so we can have the defaults in there

Comment thread src/components/tests/Outline.js Outdated
location: generateFuncLocation(startLine)
};

component.setProps({ sourceText, selectedSource });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could we pass selectedSource in when we initially render the component?

Perhaps not based on how we're fetching the symbols, which is a shame i suppose. And if that's the case, we probably move symbols to a reducer so that we can have the symbols passed down alongside the source :) (we can do this in a new issue ofcourse)

- use object destructuring for props
- create a generateSymbolDeclaration function
- refactor the tests so that thre is a clear render with overrides
function
- remove aspects of the test that gave the wrong impression about how
the code was working
- add comments
@codehag
Copy link
Copy Markdown
Contributor Author

codehag commented May 10, 2017

  • use object destructuring for props
  • create a generateSymbolDeclaration function
  • refactor the tests so that there is a clear render with overrides
    function
  • remove aspects of the test that gave the wrong impression about how
    the code was working
  • add comments

@codehag codehag changed the title [WIP] outlineview style the list of functions OutlineView style the list of functions May 10, 2017
}

.outline-list__element {
color: blue;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this still used?

@jasonLaster jasonLaster merged commit c39e03a into master May 10, 2017
@wldcordeiro wldcordeiro deleted the feature/2562-outlineview-style-the-list-of-functions branch June 28, 2017 19:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants