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

Added more scope support facets #2102

Merged
merged 49 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d3a196c
for each
AndreasArvidsson Dec 7, 2023
bae3583
Added more
AndreasArvidsson Dec 7, 2023
3525858
more
AndreasArvidsson Dec 7, 2023
1997d75
Add comment
AndreasArvidsson Dec 7, 2023
fde9bac
ternary
AndreasArvidsson Dec 7, 2023
3f32970
Function call
AndreasArvidsson Dec 7, 2023
5a06996
enable all test
AndreasArvidsson Dec 7, 2023
a5ebef6
Update tests
AndreasArvidsson Dec 7, 2023
4496739
branch
AndreasArvidsson Dec 7, 2023
c3057f1
Added arguments
AndreasArvidsson Dec 7, 2023
e314a9b
Textual
AndreasArvidsson Dec 7, 2023
24a266f
command
AndreasArvidsson Dec 7, 2023
f87fecb
tags
AndreasArvidsson Dec 7, 2023
745b406
regularExpression
AndreasArvidsson Dec 7, 2023
cba9f94
subject and field
AndreasArvidsson Dec 7, 2023
f391892
More types
AndreasArvidsson Dec 7, 2023
515e352
clean up
AndreasArvidsson Dec 7, 2023
8ba9586
Merge branch 'main' into scopes
AndreasArvidsson Dec 7, 2023
5e439d3
More tests
AndreasArvidsson Dec 8, 2023
b16ad6f
Added argument iteration
AndreasArvidsson Dec 8, 2023
ac2f077
Merge branch 'main' into scopes
AndreasArvidsson Dec 8, 2023
c741913
Add argument fixtures
AndreasArvidsson Dec 9, 2023
5ff1820
Update scope
AndreasArvidsson Dec 9, 2023
16bad52
clean up
AndreasArvidsson Dec 9, 2023
e27dcac
Tweaks
pokey Dec 11, 2023
7e5d5ac
More tweaks# Please enter the commit message for your changes. Lines …
pokey Dec 11, 2023
c0a2da5
Tweak facets
pokey Dec 11, 2023
47aa46b
Add assignment pattern
pokey Dec 11, 2023
b25eb9c
Add some iteration scopes
pokey Dec 11, 2023
515e129
More tweaks
pokey Dec 11, 2023
e18b808
TWeak
pokey Dec 11, 2023
1280ab9
Woops
pokey Dec 11, 2023
996e23f
Update packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
AndreasArvidsson Dec 11, 2023
171ccfd
Update packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
AndreasArvidsson Dec 11, 2023
3703c3b
Update packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
AndreasArvidsson Dec 11, 2023
10ef954
Update packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
AndreasArvidsson Dec 11, 2023
b84d97a
Merge branch 'main' into scopes
AndreasArvidsson Dec 11, 2023
2163c20
cleaned up leading trailing
AndreasArvidsson Dec 11, 2023
ae9e7a4
Updated field removal
AndreasArvidsson Dec 11, 2023
50aa135
Update packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
AndreasArvidsson Dec 11, 2023
7973111
Update packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
AndreasArvidsson Dec 11, 2023
4bbaf0a
Update packages/common/src/scopeSupportFacets/scopeSupportFacetInfos.ts
AndreasArvidsson Dec 11, 2023
ef3b29b
use legacy
AndreasArvidsson Dec 12, 2023
96eb2ea
Revert call domain
AndreasArvidsson Dec 13, 2023
877474a
Clean up
AndreasArvidsson Dec 13, 2023
4d8a57c
cleanup
AndreasArvidsson Dec 13, 2023
54b5564
update comment
AndreasArvidsson Dec 13, 2023
5e1abf8
Clean up
AndreasArvidsson Dec 13, 2023
a02fad5
Remove lambda facet
AndreasArvidsson Dec 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}'`);
}
23 changes: 15 additions & 8 deletions packages/common/src/scopeSupportFacets/html.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
pokey marked this conversation as resolved.
Show resolved Hide resolved

import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
Expand All @@ -6,14 +8,19 @@ import {
const { supported, notApplicable } = ScopeSupportFacetLevel;

export const htmlScopeSupport: LanguageScopeSupportFacetMap = {
["key.attribute"]: supported,
["tags"]: supported,
element: supported,
tags: supported,
startTag: supported,
endTag: supported,
attribute: supported,
"key.attribute": supported,
"value.attribute": supported,

namedFunction: notApplicable,
["name.assignment"]: notApplicable,
["key.mapPair"]: notApplicable,
["key.mapPair.iteration"]: notApplicable,
["value.mapPair"]: notApplicable,
["value.mapPair.iteration"]: notApplicable,
["value.assignment"]: notApplicable,
"name.assignment": notApplicable,
"key.mapPair": notApplicable,
"key.mapPair.iteration": notApplicable,
"value.mapPair": notApplicable,
"value.mapPair.iteration": notApplicable,
"value.assignment": notApplicable,
};
20 changes: 20 additions & 0 deletions packages/common/src/scopeSupportFacets/java.ts
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,
};
71 changes: 61 additions & 10 deletions packages/common/src/scopeSupportFacets/javascript.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,70 @@
/* eslint-disable @typescript-eslint/naming-convention */

import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";

const { supported, notApplicable } = ScopeSupportFacetLevel;
const { supported } = ScopeSupportFacetLevel;

export const javascriptScopeSupport: LanguageScopeSupportFacetMap = {
list: supported,
map: supported,
statement: supported,
ifStatement: supported,
regularExpression: supported,
switchStatementSubject: supported,
fieldAccess: supported,

class: supported,
className: supported,

namedFunction: supported,
["name.assignment"]: supported,
["key.mapPair"]: supported,
["key.mapPair.iteration"]: supported,
["value.mapPair"]: supported,
["value.mapPair.iteration"]: supported,
["value.assignment"]: supported,

["key.attribute"]: notApplicable,
["tags"]: notApplicable,
"namedFunction.method": supported,
anonymousFunction: supported,
"anonymousFunction.lambda": supported,
functionName: supported,

functionCall: supported,
"functionCall.constructor": supported,
functionCallee: supported,
"functionCallee.constructor": supported,

// FIXME: Still in legacy
// "argumentOrParameter.actual": supported,
// "argumentOrParameter.formal": supported,

"comment.line": supported,
"comment.block": supported,

"string.singleLine": supported,
"string.multiLine": supported,

"branch.if": supported,
"branch.try": supported,
"branch.switchCase": supported,

"condition.if": supported,
"condition.while": supported,
"condition.doWhile": supported,
"condition.for": supported,
"condition.ternary": supported,
"condition.switchCase": supported,

"name.foreach": supported,
"name.assignment": supported,
"name.function": supported,
"name.class": supported,
"name.field": supported,

"key.mapPair": supported,
"key.mapPair.iteration": supported,

"value.mapPair": supported,
"value.mapPair.iteration": supported,
"value.assignment": supported,
"value.foreach": supported,
"value.return": supported,
"value.return.lambda": supported,
"value.field": supported,
};
19 changes: 19 additions & 0 deletions packages/common/src/scopeSupportFacets/python.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable @typescript-eslint/naming-convention */

import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";

const { supported, notApplicable } = ScopeSupportFacetLevel;

export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
"name.foreach": supported,
"value.foreach": supported,

element: notApplicable,
tags: notApplicable,
attribute: notApplicable,
"key.attribute": notApplicable,
"value.attribute": notApplicable,
};
Loading