File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
packages/cursorless-org-docs/src/docs/contributing Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 77 type ScopeType ,
88 type SimpleScopeTypeType ,
99} from "@cursorless/common" ;
10- import React , { useState } from "react" ;
10+ import React , { useEffect , useState } from "react" ;
1111
1212export function MissingLanguageScopes ( ) : React . JSX . Element [ ] {
1313 return Object . keys ( languageScopeSupport )
@@ -52,14 +52,19 @@ function renderFacets(
5252 facets : ScopeSupportFacet [ ] ,
5353) : React . JSX . Element | null {
5454 const [ open , setOpen ] = useState ( false ) ;
55+ const [ scopes , setScopes ] = useState < string [ ] > ( [ ] ) ;
5556
56- const scopes = Array . from (
57- new Set (
58- facets . map ( ( f ) =>
59- serializeScopeType ( scopeSupportFacetInfos [ f ] . scopeType ) ,
57+ useEffect ( ( ) => {
58+ const scopes = Array . from (
59+ new Set (
60+ facets . map ( ( f ) =>
61+ serializeScopeType ( scopeSupportFacetInfos [ f ] . scopeType ) ,
62+ ) ,
6063 ) ,
61- ) ,
62- ) . sort ( ) ;
64+ ) . sort ( ) ;
65+ setScopes ( scopes ) ;
66+ setOpen ( scopes . length < 4 ) ;
67+ } , [ ] ) ;
6368
6469 if ( scopes . length === 0 ) {
6570 return null ;
You can’t perform that action at this time.
0 commit comments