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

feat: Add primitive types to forc-doc #6032

Merged
merged 12 commits into from
May 28, 2024
Merged

Conversation

sdankel
Copy link
Member

@sdankel sdankel commented May 19, 2024

Description

Closes #5968

Adds a new "Primitive" type in the sidebar and to the search bar. The descriptions are hard coded since there is nowhere to parse the documentation from. The list of primitives is also hardcoded, so we will need to update forc-doc if/when new primitives are added to the language.

Primitives will be documented show up in the side bar for any package that has implementations for a primitive. This is why it currently shows up for both std and core.

Side bar nav:
May-27-2024 16-54-34

Search bar:
May-27-2024 16-54-53

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

Copy link

Benchmark for fbb1148

Click to view benchmark
Test Base PR %
code_action 5.2±0.03ms 5.2±0.07ms 0.00%
code_lens 298.4±7.49ns 281.5±8.91ns -5.66%
compile 3.0±0.04s 3.0±0.05s 0.00%
completion 4.5±0.09ms 4.5±0.05ms 0.00%
did_change_with_caching 2.8±0.07s 2.8±0.07s 0.00%
document_symbol 991.3±48.34µs 951.4±7.40µs -4.03%
format 73.8±1.13ms 74.1±0.97ms +0.41%
goto_definition 366.9±10.56µs 371.4±5.62µs +1.23%
highlight 8.8±0.19ms 8.7±0.15ms -1.14%
hover 484.1±6.15µs 507.1±8.69µs +4.75%
idents_at_position 124.1±1.95µs 123.9±1.23µs -0.16%
inlay_hints 646.3±21.27µs 655.8±24.49µs +1.47%
on_enter 469.0±21.02ns 471.9±8.08ns +0.62%
parent_decl_at_position 3.6±0.02ms 3.6±0.02ms 0.00%
prepare_rename 367.4±6.22µs 366.5±5.84µs -0.24%
rename 9.2±0.03ms 9.2±0.05ms 0.00%
semantic_tokens 983.7±22.09µs 974.5±9.14µs -0.94%
token_at_position 360.4±2.54µs 368.0±2.19µs +2.11%
tokens_at_position 3.6±0.04ms 3.6±0.02ms 0.00%
tokens_for_file 417.5±2.73µs 415.2±1.74µs -0.55%
traverse 40.8±1.17ms 40.4±0.92ms -0.98%

Copy link

Benchmark for bb17db5

Click to view benchmark
Test Base PR %
code_action 5.5±0.25ms 5.2±0.16ms -5.45%
code_lens 288.1±7.53ns 342.6±11.55ns +18.92%
compile 3.0±0.05s 3.1±0.05s +3.33%
completion 4.7±0.05ms 4.6±0.10ms -2.13%
did_change_with_caching 2.9±0.04s 3.0±0.03s +3.45%
document_symbol 1038.0±20.44µs 959.4±21.08µs -7.57%
format 73.2±1.13ms 74.1±1.32ms +1.23%
goto_definition 375.0±15.90µs 360.7±5.51µs -3.81%
highlight 9.1±0.02ms 8.7±0.16ms -4.40%
hover 495.5±11.60µs 491.7±10.55µs -0.77%
idents_at_position 124.0±0.48µs 123.7±0.65µs -0.24%
inlay_hints 672.8±22.62µs 656.2±28.53µs -2.47%
on_enter 464.3±9.08ns 476.0±10.76ns +2.52%
parent_decl_at_position 3.8±0.05ms 3.6±0.05ms -5.26%
prepare_rename 369.5±13.41µs 364.2±6.18µs -1.43%
rename 9.8±0.12ms 9.3±0.06ms -5.10%
semantic_tokens 960.1±15.37µs 969.2±11.20µs +0.95%
token_at_position 360.8±2.95µs 358.8±2.69µs -0.55%
tokens_at_position 3.8±0.05ms 3.6±0.03ms -5.26%
tokens_for_file 419.2±2.10µs 432.7±6.68µs +3.22%
traverse 41.3±1.17ms 42.4±1.30ms +2.66%

Copy link

Benchmark for dd26020

Click to view benchmark
Test Base PR %
code_action 5.6±0.08ms 5.2±0.12ms -7.14%
code_lens 295.7±14.59ns 289.5±13.67ns -2.10%
compile 3.1±0.04s 3.1±0.03s 0.00%
completion 4.7±0.08ms 4.6±0.14ms -2.13%
did_change_with_caching 3.0±0.05s 2.9±0.03s -3.33%
document_symbol 1005.7±45.22µs 1023.6±29.21µs +1.78%
format 73.6±0.67ms 75.1±1.10ms +2.04%
goto_definition 368.9±6.36µs 398.2±5.50µs +7.94%
highlight 9.1±0.07ms 8.8±0.17ms -3.30%
hover 484.3±7.12µs 523.8±9.99µs +8.16%
idents_at_position 123.2±0.65µs 122.5±0.41µs -0.57%
inlay_hints 664.0±15.05µs 647.7±24.26µs -2.45%
on_enter 464.3±9.54ns 504.1±12.85ns +8.57%
parent_decl_at_position 3.7±0.02ms 3.6±0.11ms -2.70%
prepare_rename 367.2±6.66µs 398.6±5.61µs +8.55%
rename 9.8±0.22ms 9.4±0.22ms -4.08%
semantic_tokens 952.5±38.97µs 990.6±17.45µs +4.00%
token_at_position 356.6±2.16µs 363.2±2.99µs +1.85%
tokens_at_position 3.7±0.02ms 3.6±0.03ms -2.70%
tokens_for_file 416.6±4.51µs 423.2±6.72µs +1.58%
traverse 41.2±0.65ms 41.3±1.03ms +0.24%

Copy link

Benchmark for bc5639b

Click to view benchmark
Test Base PR %
code_action 5.4±0.09ms 5.3±0.09ms -1.85%
code_lens 291.6±6.94ns 288.8±8.34ns -0.96%
compile 3.0±0.03s 3.0±0.05s 0.00%
completion 4.7±0.05ms 4.6±0.07ms -2.13%
did_change_with_caching 2.9±0.03s 2.9±0.03s 0.00%
document_symbol 1022.9±19.55µs 992.6±28.23µs -2.96%
format 74.1±0.98ms 73.0±1.00ms -1.48%
goto_definition 371.2±6.23µs 359.8±5.42µs -3.07%
highlight 9.1±0.08ms 8.8±0.04ms -3.30%
hover 498.9±12.71µs 491.7±6.87µs -1.44%
idents_at_position 125.2±0.36µs 122.3±0.96µs -2.32%
inlay_hints 680.5±9.46µs 649.5±33.52µs -4.56%
on_enter 468.1±11.33ns 496.4±7.79ns +6.05%
parent_decl_at_position 3.8±0.03ms 3.6±0.04ms -5.26%
prepare_rename 373.5±3.06µs 363.5±7.28µs -2.68%
rename 9.7±0.09ms 9.4±0.23ms -3.09%
semantic_tokens 971.7±13.31µs 958.8±13.65µs -1.33%
token_at_position 371.6±2.00µs 356.1±1.50µs -4.17%
tokens_at_position 3.7±0.02ms 3.6±0.20ms -2.70%
tokens_for_file 424.2±1.78µs 419.1±2.07µs -1.20%
traverse 40.3±1.22ms 41.1±0.82ms +1.99%

Copy link

Benchmark for 55fe209

Click to view benchmark
Test Base PR %
code_action 5.4±0.07ms 5.3±0.12ms -1.85%
code_lens 296.5±7.69ns 289.8±8.64ns -2.26%
compile 3.1±0.04s 3.1±0.03s 0.00%
completion 4.7±0.05ms 4.6±0.07ms -2.13%
did_change_with_caching 2.9±0.02s 2.9±0.03s 0.00%
document_symbol 950.9±18.23µs 957.1±9.07µs +0.65%
format 74.1±1.74ms 73.8±0.98ms -0.40%
goto_definition 369.5±6.14µs 367.7±5.45µs -0.49%
highlight 9.0±0.03ms 8.8±0.21ms -2.22%
hover 492.3±5.72µs 493.7±6.31µs +0.28%
idents_at_position 123.8±0.81µs 123.3±0.60µs -0.40%
inlay_hints 669.0±29.19µs 659.7±14.87µs -1.39%
on_enter 473.9±14.96ns 486.4±12.93ns +2.64%
parent_decl_at_position 3.7±0.03ms 3.6±0.04ms -2.70%
prepare_rename 370.1±5.76µs 366.0±6.99µs -1.11%
rename 9.7±0.16ms 9.4±0.26ms -3.09%
semantic_tokens 978.0±21.77µs 981.7±24.91µs +0.38%
token_at_position 361.1±2.84µs 365.7±4.23µs +1.27%
tokens_at_position 3.8±0.03ms 3.6±0.03ms -5.26%
tokens_for_file 424.3±3.18µs 426.6±2.24µs +0.54%
traverse 41.1±1.37ms 41.0±1.48ms -0.24%

@sdankel sdankel marked this pull request as ready for review May 27, 2024 21:10
@JoshuaBatty JoshuaBatty added the forc-doc Everything related to the `forc doc` command plugin. label May 27, 2024
@JoshuaBatty JoshuaBatty requested a review from a team May 27, 2024 23:14
Copy link

Benchmark for 3349c49

Click to view benchmark
Test Base PR %
code_action 5.4±0.06ms 5.2±0.10ms -3.70%
code_lens 296.4±10.95ns 290.9±7.88ns -1.86%
compile 3.1±0.05s 3.1±0.06s 0.00%
completion 4.8±0.05ms 4.6±0.05ms -4.17%
did_change_with_caching 3.0±0.05s 2.9±0.04s -3.33%
document_symbol 953.1±11.26µs 1000.0±30.01µs +4.92%
format 75.0±1.10ms 73.7±0.77ms -1.73%
goto_definition 366.4±7.15µs 360.5±5.15µs -1.61%
highlight 9.1±0.35ms 8.7±0.13ms -4.40%
hover 491.6±4.63µs 484.2±7.74µs -1.51%
idents_at_position 123.0±0.42µs 123.9±0.88µs +0.73%
inlay_hints 662.5±10.40µs 650.7±12.40µs -1.78%
on_enter 463.3±15.06ns 482.8±7.24ns +4.21%
parent_decl_at_position 3.7±0.02ms 3.6±0.02ms -2.70%
prepare_rename 362.8±6.17µs 360.7±5.63µs -0.58%
rename 9.7±0.03ms 9.5±0.27ms -2.06%
semantic_tokens 976.8±10.97µs 971.4±34.54µs -0.55%
token_at_position 363.4±1.37µs 355.4±3.57µs -2.20%
tokens_at_position 3.7±0.04ms 3.6±0.03ms -2.70%
tokens_for_file 421.3±5.26µs 419.8±4.54µs -0.36%
traverse 41.8±0.85ms 41.6±1.57ms -0.48%

Copy link
Member

@JoshuaBatty JoshuaBatty left a comment

Choose a reason for hiding this comment

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

Thanks for this, code looks good.

@sdankel sdankel enabled auto-merge (squash) May 28, 2024 17:46
Copy link

Benchmark for 300bedf

Click to view benchmark
Test Base PR %
code_action 5.4±0.06ms 5.2±0.12ms -3.70%
code_lens 292.8±6.90ns 289.1±12.63ns -1.26%
compile 3.0±0.04s 3.0±0.05s 0.00%
completion 4.7±0.01ms 4.5±0.10ms -4.26%
did_change_with_caching 2.9±0.06s 2.9±0.02s 0.00%
document_symbol 984.0±38.57µs 1005.0±20.96µs +2.13%
format 73.8±1.15ms 74.0±1.22ms +0.27%
goto_definition 363.9±5.44µs 365.3±5.01µs +0.38%
highlight 9.1±0.17ms 8.8±0.23ms -3.30%
hover 484.8±6.47µs 489.8±7.81µs +1.03%
idents_at_position 124.1±0.84µs 122.4±1.00µs -1.37%
inlay_hints 672.0±10.44µs 645.5±9.67µs -3.94%
on_enter 467.3±21.21ns 482.8±8.93ns +3.32%
parent_decl_at_position 3.7±0.03ms 3.6±0.03ms -2.70%
prepare_rename 363.8±7.95µs 365.8±7.91µs +0.55%
rename 9.8±0.65ms 9.4±0.21ms -4.08%
semantic_tokens 965.2±13.89µs 967.2±17.71µs +0.21%
token_at_position 359.3±2.29µs 357.0±3.19µs -0.64%
tokens_at_position 3.7±0.02ms 3.6±0.04ms -2.70%
tokens_for_file 416.7±2.13µs 425.3±3.29µs +2.06%
traverse 41.7±1.02ms 41.9±1.05ms +0.48%

@sdankel sdankel merged commit f342f52 into master May 28, 2024
38 checks passed
@sdankel sdankel deleted the sophie/forc-doc-primitives branch May 28, 2024 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forc-doc Everything related to the `forc doc` command plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include primitive types in forc-doc generated docs
3 participants