-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more scope support facets (#2102)
This pull request has these goals: 1. To flesh out the available facets and their definitions 2. To provide one example scope fixture of each facet 3. Update the domain of for each loops name/value/type 4. Update domain of iteration scope for formal arguments Once the above is done I'm going to do the bulk fixture recorder we talked about to fill in the other languages. ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet --------- Co-authored-by: Pokey Rule <[email protected]>
- Loading branch information
1 parent
730349d
commit 15bfde5
Showing
95 changed files
with
2,571 additions
and
94 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
packages/common/src/scopeSupportFacets/getLanguageScopeSupport.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
import { htmlScopeSupport } from "./html"; | ||
import { javaScopeSupport } from "./java"; | ||
import { javascriptScopeSupport } from "./javascript"; | ||
import { pythonScopeSupport } from "./python"; | ||
import { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; | ||
import { talonScopeSupport } from "./talon"; | ||
import { typescriptScopeSupport } from "./typescript"; | ||
|
||
export function getLanguageScopeSupport( | ||
languageId: string, | ||
): LanguageScopeSupportFacetMap { | ||
switch (languageId) { | ||
case "javascript": | ||
return javascriptScopeSupport; | ||
case "typescript": | ||
return typescriptScopeSupport; | ||
case "java": | ||
return javaScopeSupport; | ||
case "python": | ||
return pythonScopeSupport; | ||
case "html": | ||
return htmlScopeSupport; | ||
case "talon": | ||
return talonScopeSupport; | ||
} | ||
throw Error(`Unsupported language: '${languageId}'`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
|
||
import { | ||
LanguageScopeSupportFacetMap, | ||
ScopeSupportFacetLevel, | ||
} from "./scopeSupportFacets.types"; | ||
|
||
const { supported, notApplicable } = ScopeSupportFacetLevel; | ||
|
||
export const javaScopeSupport: LanguageScopeSupportFacetMap = { | ||
"name.foreach": supported, | ||
"value.foreach": supported, | ||
"type.foreach": supported, | ||
|
||
element: notApplicable, | ||
tags: notApplicable, | ||
attribute: notApplicable, | ||
"key.attribute": notApplicable, | ||
"value.attribute": notApplicable, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
|
||
import { | ||
LanguageScopeSupportFacetMap, | ||
ScopeSupportFacetLevel, | ||
} from "./scopeSupportFacets.types"; | ||
|
||
const { supported, supportedLegacy, notApplicable } = ScopeSupportFacetLevel; | ||
|
||
export const pythonScopeSupport: LanguageScopeSupportFacetMap = { | ||
"name.foreach": supported, | ||
"value.foreach": supported, | ||
|
||
"argument.actual": supportedLegacy, | ||
"argument.actual.iteration": supportedLegacy, | ||
"argument.formal": supportedLegacy, | ||
"argument.formal.iteration": supportedLegacy, | ||
|
||
element: notApplicable, | ||
tags: notApplicable, | ||
attribute: notApplicable, | ||
"key.attribute": notApplicable, | ||
"value.attribute": notApplicable, | ||
}; |
Oops, something went wrong.