Skip to content

Support the C# plugin in the new web GUI#862

Open
HorvathDaniel15 wants to merge 2 commits into
Ericsson:feature/csharp_pluginfrom
HorvathDaniel15:feature/support-csharp-plugin-in-new-web-gui
Open

Support the C# plugin in the new web GUI#862
HorvathDaniel15 wants to merge 2 commits into
Ericsson:feature/csharp_pluginfrom
HorvathDaniel15:feature/support-csharp-plugin-in-new-web-gui

Conversation

@HorvathDaniel15
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds C# support to the new web GUI by routing language-dependent UI features (diagrams, references, highlighting, search filters) through the appropriate language plugin/service and enabling C# syntax highlighting in the editor components.

Changes:

  • Extend language-service / UI flows to support the C# plugin (CSCsharpService) and update multiple components to use the unified language service APIs instead of C++-specific ones.
  • Add C# search language options and MIME filters, plus include C# in metrics file-type filters.
  • Add CodeMirror C# language support via @replit/codemirror-lang-csharp and use it in the editor and CodeBites views.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
webgui-new/src/service/language-service.ts Adds CSCsharpService routing and connection options for the unified language service client.
webgui-new/src/global-context/app-context.tsx Removes C++-specific client initialization and applies formatting/URL-state cleanup.
webgui-new/src/enums/search-enum.ts Adds C# as a main language and C# MIME types.
webgui-new/src/components/metrics/metrics.tsx Adds CS to metrics file-type filters and formatting updates.
webgui-new/src/components/info-tree/info-tree.tsx Uses unified language service and adds cancellation handling during async loading.
webgui-new/src/components/header/header.tsx Adds C# language query support for search and refactors formatting.
webgui-new/src/components/file-name/file-name.tsx Switches file-reference menu from C++-specific service calls to unified language-service calls.
webgui-new/src/components/file-context-menu/file-context-menu.tsx Switches file diagram type loading from C++ service to unified language service.
webgui-new/src/components/diagrams/diagrams.tsx Switches diagram/ref resolution from C++ service to unified language service and updates client selection logic.
webgui-new/src/components/codemirror-editor/codemirror-editor.tsx Adds C# syntax highlighting and updates reference-based highlighting to use unified language service.
webgui-new/src/components/codebites/codebites-node.tsx Switches CodeBites fetching/navigation from C++ service to unified language service and adds per-language CodeMirror extension.
webgui-new/package.json Adds @replit/codemirror-lang-csharp dependency.
webgui-new/package-lock.json Locks @replit/codemirror-lang-csharp dependency.
plugins/csharp/service/src/csharpservice.cpp Improves robustness when mapping file paths/ids (null checks + logging) for C# service responses.
Files not reviewed (1)
  • webgui-new/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

webgui-new/src/components/diagrams/diagrams.tsx:220

  • Same issue as the main diagram parsing: generateLegend assumes the legend response contains an <svg> element. If the legend string is empty/invalid, diagramLegendSvg will be undefined and .style / replaceChildren will throw. Add a guard for missing <svg> and handle the error path gracefully.
    const diagramLegend =
      diagramInfo instanceof FileInfo
        ? await getFileDiagramLegend(parseInt(appCtx.diagramTypeId))
        : diagramInfo instanceof AstNodeInfo
          ? await getDiagramLegend(parseInt(appCtx.diagramTypeId))
          : "";

    const parser = new DOMParser();
    const parsedDiagramLegend = parser.parseFromString(
      diagramLegend,
      "text/xml",
    );
    const diagramLegendSvg = parsedDiagramLegend.getElementsByTagName("svg")[0];

    diagramLegendSvg.style.height = "100%";
    diagramLegendContainerRef.current.replaceChildren(diagramLegendSvg);


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 6 to +28
let client: LanguageService.Client | undefined;
export const createClient = (workspace: string, fileType: string | undefined) => {
export const createClient = (
workspace: string,
fileType: string | undefined,
) => {
if (!config || !fileType) return;

const service = () =>
{
switch(fileType)
{

const service = () => {
switch (fileType) {
case "CPP":
return "CppService";
case "PY":
return "PythonService";
case "CS":
return "CsharpService";
default:
return undefined;
}
};

const connection = thrift.createXHRConnection(config.webserver_host, config.webserver_port, {
transport: thrift.TBufferedTransport,
protocol: thrift.TJSONProtocol,
https: config.webserver_https,
path: `${config.webserver_path}/${workspace}/${service()}`,
});
const serviceName = service();
if (!serviceName) return;

Comment on lines 48 to +56
useEffect(() => {
if (!fileInfo) return;
const init = async () => {
const initDiagramTypes = await getCppFileDiagramTypes(fileInfo.id as string);
createClient(appCtx.workspaceId, fileInfo?.type);
const initDiagramTypes = await getFileDiagramTypes(fileInfo.id as string);
setDiagramTypes(initDiagramTypes);
};
init();
}, [fileInfo]);
}, [appCtx.workspaceId, fileInfo]);
Comment on lines +144 to +146
const decorations = highlightRanges.map((pos) =>
createHighlightDecoration(view, pos, highlightColor),
) as never;
Comment on lines +167 to +169
const allReferences = await getReferences(
astNode.id as string,
refTypes.get("Usage") as number,
Comment on lines +61 to +75
const fileInfoForClient =
appCtx.diagramType === "file"
? await getFileInfo(appCtx.diagramGenId)
: appCtx.diagramType === 'ast'
? await getCppAstNodeInfo(appCtx.diagramGenId)
: undefined;
: appCtx.projectFileId
? await getFileInfo(appCtx.projectFileId)
: undefined;

createClient(appCtx.workspaceId, fileInfoForClient?.type);

const initDiagramInfo =
appCtx.diagramType === "file"
? fileInfoForClient
: appCtx.diagramType === "ast"
? await getAstNodeInfo(appCtx.diagramGenId)
: undefined;
Comment on lines 120 to 128
const parser = new DOMParser();
const parsedDiagram = parser.parseFromString(diagram, 'text/xml');
const diagramSvg = parsedDiagram.getElementsByTagName('svg')[0];
const parsedDiagram = parser.parseFromString(diagram, "text/xml");
const diagramSvg = parsedDiagram.getElementsByTagName("svg")[0];

diagramSvg.style.height = '100%';
diagramSvg.style.cursor = 'pointer';
diagramSvg.style.height = "100%";
diagramSvg.style.cursor = "pointer";

transformComponentRef?.current?.resetTransform();
diagramContainerRef?.current?.replaceChildren(diagramSvg);
Comment on lines 70 to 80
return _db->query_one<model::File>(
FileQuery::path == return_.range.file);
});
if (!file)
{
LOG(warning) << "[csharpservice] getAstNodeInfo: file not found for path: " << return_.range.file;
return;
}
std::stringstream ss;
ss << file;
ss << file->id;
return_.range.file = ss.str();
@HorvathDaniel15
Copy link
Copy Markdown
Collaborator Author

I get this error message when I click on a method name to view its information.
Képernyőfotó 2026-05-20 - 22 14 03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants