Show labels for methods only classified in test and generated
This commit is contained in:
@@ -116,6 +116,17 @@ DataExtensionsEditor.args = {
|
|||||||
},
|
},
|
||||||
classification: CallClassification.Source,
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "println(...)",
|
||||||
|
url: {
|
||||||
|
uri: "file:/home/runner/work/sql2o-example/sql2o-example/src/test/java/org/example/HelloControllerTest.java",
|
||||||
|
startLine: 29,
|
||||||
|
startColumn: 9,
|
||||||
|
endLine: 29,
|
||||||
|
endColumn: 49,
|
||||||
|
},
|
||||||
|
classification: CallClassification.Test,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -170,17 +181,30 @@ DataExtensionsEditor.args = {
|
|||||||
methodParameters: "(String)",
|
methodParameters: "(String)",
|
||||||
supported: false,
|
supported: false,
|
||||||
supportedType: "none",
|
supportedType: "none",
|
||||||
usages: Array(4).fill({
|
usages: [
|
||||||
label: "new Sql2o(...)",
|
...Array(4).fill({
|
||||||
url: {
|
label: "new Sql2o(...)",
|
||||||
uri: "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java",
|
url: {
|
||||||
startLine: 23,
|
uri: "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java",
|
||||||
startColumn: 23,
|
startLine: 23,
|
||||||
endLine: 23,
|
startColumn: 23,
|
||||||
endColumn: 36,
|
endLine: 23,
|
||||||
|
endColumn: 36,
|
||||||
|
},
|
||||||
|
classification: CallClassification.Test,
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
label: "new Sql2o(...)",
|
||||||
|
url: {
|
||||||
|
uri: "file:/home/runner/work/sql2o-example/sql2o-example/build/generated/java/org/example/HelloControllerGenerated.java",
|
||||||
|
startLine: 23,
|
||||||
|
startColumn: 23,
|
||||||
|
endLine: 23,
|
||||||
|
endColumn: 36,
|
||||||
|
},
|
||||||
|
classification: CallClassification.Generated,
|
||||||
},
|
},
|
||||||
classification: CallClassification.Source,
|
],
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
initialModeledMethods: {
|
initialModeledMethods: {
|
||||||
|
|||||||
@@ -3,13 +3,17 @@ import {
|
|||||||
VSCodeDataGridCell,
|
VSCodeDataGridCell,
|
||||||
VSCodeDataGridRow,
|
VSCodeDataGridRow,
|
||||||
VSCodeLink,
|
VSCodeLink,
|
||||||
|
VSCodeTag,
|
||||||
} from "@vscode/webview-ui-toolkit/react";
|
} from "@vscode/webview-ui-toolkit/react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { ChangeEvent, useCallback, useMemo } from "react";
|
import { ChangeEvent, useCallback, useMemo } from "react";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { vscode } from "../vscode-api";
|
import { vscode } from "../vscode-api";
|
||||||
|
|
||||||
import { ExternalApiUsage } from "../../data-extensions-editor/external-api-usage";
|
import {
|
||||||
|
CallClassification,
|
||||||
|
ExternalApiUsage,
|
||||||
|
} from "../../data-extensions-editor/external-api-usage";
|
||||||
import {
|
import {
|
||||||
ModeledMethod,
|
ModeledMethod,
|
||||||
ModeledMethodType,
|
ModeledMethodType,
|
||||||
@@ -39,6 +43,12 @@ const ViewLink = styled(VSCodeLink)`
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const ClassificationsContainer = styled.div`
|
||||||
|
display: inline-flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 0.5rem;
|
||||||
|
`;
|
||||||
|
|
||||||
const modelTypeOptions: Array<{ value: ModeledMethodType; label: string }> = [
|
const modelTypeOptions: Array<{ value: ModeledMethodType; label: string }> = [
|
||||||
{ value: "none", label: "Unmodeled" },
|
{ value: "none", label: "Unmodeled" },
|
||||||
{ value: "source", label: "Source" },
|
{ value: "source", label: "Source" },
|
||||||
@@ -194,6 +204,20 @@ function ModelableMethodRow(props: Props) {
|
|||||||
: undefined;
|
: undefined;
|
||||||
const showKindCell = predicate?.supportedKinds;
|
const showKindCell = predicate?.supportedKinds;
|
||||||
|
|
||||||
|
const allUsageClassifications = useMemo(
|
||||||
|
() =>
|
||||||
|
new Set(
|
||||||
|
externalApiUsage.usages.map((usage) => {
|
||||||
|
return usage.classification;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
[externalApiUsage.usages],
|
||||||
|
);
|
||||||
|
|
||||||
|
const inSource = allUsageClassifications.has(CallClassification.Source);
|
||||||
|
const inTest = allUsageClassifications.has(CallClassification.Test);
|
||||||
|
const inGenerated = allUsageClassifications.has(CallClassification.Generated);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<VSCodeDataGridRow>
|
<VSCodeDataGridRow>
|
||||||
<ApiOrMethodCell gridColumn={1}>
|
<ApiOrMethodCell gridColumn={1}>
|
||||||
@@ -205,6 +229,12 @@ function ModelableMethodRow(props: Props) {
|
|||||||
</UsagesButton>
|
</UsagesButton>
|
||||||
)}
|
)}
|
||||||
<ViewLink onClick={jumpToUsage}>View</ViewLink>
|
<ViewLink onClick={jumpToUsage}>View</ViewLink>
|
||||||
|
{!inSource && (
|
||||||
|
<ClassificationsContainer>
|
||||||
|
{inTest && <VSCodeTag>Test</VSCodeTag>}
|
||||||
|
{inGenerated && <VSCodeTag>Generated</VSCodeTag>}
|
||||||
|
</ClassificationsContainer>
|
||||||
|
)}
|
||||||
</ApiOrMethodCell>
|
</ApiOrMethodCell>
|
||||||
<VSCodeDataGridCell gridColumn={2}>
|
<VSCodeDataGridCell gridColumn={2}>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
|||||||
Reference in New Issue
Block a user