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

feat: add C# support #4908

Merged
merged 28 commits into from
Dec 12, 2024
Merged

feat: add C# support #4908

merged 28 commits into from
Dec 12, 2024

Conversation

wendrul
Copy link
Contributor

@wendrul wendrul commented Dec 12, 2024

Important

Add comprehensive C# support across frontend and backend, including editor configuration, syntax highlighting, and script execution.

  • Frontend:
    • Add C# support in Editor.svelte, EditorBar.svelte, and HighlightCode.svelte for syntax highlighting and editor configuration.
    • Update WorkerGroup.svelte and LanguageIcon.svelte to include C# in language options and icons.
    • Integrate C# initial code template in script_helpers.ts.
  • Backend:
    • Add C# parser in windmill-parser-csharp with lib.rs and wasm_libc.rs for parsing C# scripts.
    • Update Cargo.toml and Cargo.lock to include tree-sitter-c-sharp and related dependencies.
    • Add C# support in windmill-worker with csharp_executor.rs for handling C# job execution.
    • Update main.rs and worker.rs to include C# in supported languages.
  • Miscellaneous:
    • Add C# icon in CSharpIcon.svelte for visual representation.
    • Ensure C# is included in language processing functions in infer.ts and editorUtils.ts.

This description was created by Ellipsis for 9a16e3f. It will automatically update as commits are pushed.

@wendrul wendrul requested a review from rubenfiszel as a code owner December 12, 2024 09:28
@wendrul wendrul marked this pull request as draft December 12, 2024 09:30
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to dc05560 in 2 minutes and 16 seconds

More details
  • Looked at 2410 lines of code in 51 files
  • Skipped 1 files when reviewing.
  • Skipped posting 8 drafted comments based on config settings.
1. frontend/src/lib/components/HighlightCode.svelte:59
  • Draft comment:
    C# language support added. Ensure that the corresponding syntax highlighting is correctly configured.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The PR adds C# support, and the changes in this file are consistent with that intent. The language 'csharp' is added to the list of supported languages in various places, ensuring that the UI components handle C# scripts correctly. This is a necessary change to integrate C# support into the frontend.
2. frontend/src/lib/components/WorkerGroup.svelte:125
  • Draft comment:
    C# language support added to default tags. Ensure that the backend supports these tags as expected.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The PR adds C# support, and the changes in this file are consistent with that intent. The language 'csharp' is added to the list of supported languages in various places, ensuring that the UI components handle C# scripts correctly. This is a necessary change to integrate C# support into the frontend.
3. frontend/src/lib/components/common/languageIcons/LanguageIcon.svelte:55
  • Draft comment:
    C# language label added. Ensure that the label is displayed correctly in the UI.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The PR adds C# support, and the changes in this file are consistent with that intent. The language 'csharp' is added to the list of supported languages in various places, ensuring that the UI components handle C# scripts correctly. This is a necessary change to integrate C# support into the frontend.
4. frontend/src/lib/editorUtils.ts:84
  • Draft comment:
    C# file extension mapping added. Ensure that this mapping is used correctly when handling C# files.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The PR adds C# support, and the changes in this file are consistent with that intent. The language 'csharp' is added to the list of supported languages in various places, ensuring that the UI components handle C# scripts correctly. This is a necessary change to integrate C# support into the frontend.
5. frontend/src/lib/infer.ts:169
  • Draft comment:
    C# parser initialization added. Ensure that the parser is correctly initialized and used for C# scripts.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The PR adds C# support, and the changes in this file are consistent with that intent. The language 'csharp' is added to the list of supported languages in various places, ensuring that the UI components handle C# scripts correctly. This is a necessary change to integrate C# support into the frontend.
6. frontend/src/lib/script_helpers.ts:820
  • Draft comment:
    C# initial code template added. Ensure that this template is used correctly when creating new C# scripts.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The PR adds C# support, and the changes in this file are consistent with that intent. The language 'csharp' is added to the list of supported languages in various places, ensuring that the UI components handle C# scripts correctly. This is a necessary change to integrate C# support into the frontend.
7. frontend/src/lib/scripts.ts:121
  • Draft comment:
    C# added to the list of script languages. Ensure that this is reflected in the UI where script languages are displayed.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The PR adds C# support, and the changes in this file are consistent with that intent. The language 'csharp' is added to the list of supported languages in various places, ensuring that the UI components handle C# scripts correctly. This is a necessary change to integrate C# support into the frontend.
8. frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte:733
  • Draft comment:
    C# tag added to the exclusion list for job tags. Ensure that this is consistent with how other languages are handled.
  • Reason this comment was not posted:
    Confidence changes required: 20%
    The PR adds C# support, and the changes in this file are consistent with that intent. The language 'csharp' is added to the list of supported languages in various places, ensuring that the UI components handle C# scripts correctly. This is a necessary change to integrate C# support into the frontend.

Workflow ID: wflow_iHDNh0tsIPdVV0AT


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@wendrul wendrul marked this pull request as ready for review December 12, 2024 09:53
Copy link

cloudflare-workers-and-pages bot commented Dec 12, 2024

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a16e3f
Status: ✅  Deploy successful!
Preview URL: https://aa754c68.windmill.pages.dev
Branch Preview URL: https://win-444-add-support-for-csha.windmill.pages.dev

View logs

@wendrul wendrul changed the title feat: add C# support WIP: feat: add C# support Dec 12, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on e66ee4f in 1 minute and 57 seconds

More details
  • Looked at 14587 lines of code in 162 files
  • Skipped 1 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_KwmYt4g6XiDDW3vU


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 4d541d7 in 24 seconds

More details
  • Looked at 10 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_CsxJTnOT2iAClWHa


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 6bae455 in 10 minutes and 44 seconds

More details
  • Looked at 79 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_qNGkEUKwOiD4I1Uo


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 94f4556 in 28 seconds

More details
  • Looked at 33 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. backend/tests/worker.rs:1812
  • Draft comment:
    The method name Main is typically used for entry points in C#. Ensure this is intentional and aligns with the expected behavior in the test context.
  • Reason this comment was not posted:
    Confidence changes required: 33%
    The C# script in the test function uses a method named 'Main', which is a common convention in C# for entry points. However, the method signature and usage seem correct for the context of this test.

Workflow ID: wflow_Ffkvm3u7pSMFrsYY


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 7befa69 in 48 seconds

More details
  • Looked at 25 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. docker/DockerfileFullEe:7
  • Draft comment:
    Consider using a symbolic link instead of copying the dotnet binary to /usr/bin. This ensures that any dependencies or configurations are correctly resolved.
RUN ln -s /opt/dotnet-sdk/bin/dotnet /usr/bin/dotnet
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_E3sONON4LQ5f2jR2


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -3,4 +3,7 @@ FROM ghcr.io/windmill-labs/windmill:dev
COPY --from=rust:1.80.1 /usr/local/cargo /usr/local/cargo
COPY --from=rust:1.80.1 /usr/local/rustup /usr/local/rustup

COPY --from=bitnami/dotnet-sdk:9.0.101-debian-12-r0 /opt/bitnami/dotnet-sdk /opt/dotnet-sdk
RUN cp /opt/dotnet-sdk/bin/dotnet /usr/bin/dotnet
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using a symbolic link instead of copying the dotnet binary to /usr/bin. This ensures that any dependencies or configurations are correctly resolved.

Suggested change
RUN cp /opt/dotnet-sdk/bin/dotnet /usr/bin/dotnet
RUN ln -s /opt/dotnet-sdk/bin/dotnet /usr/bin/dotnet

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on ac6b937 in 30 seconds

More details
  • Looked at 35 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. docker/DockerfileFull:7
  • Draft comment:
    Using ln -s to create a symbolic link for dotnet is a good practice as it avoids redundancy and ensures that updates to the SDK are reflected without needing to copy the binary again.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The change from cp to ln -s is appropriate for creating a symbolic link, which is generally preferred for executables to avoid redundancy and potential issues with updates.
2. docker/DockerfileFullEe:7
  • Draft comment:
    Using ln -s to create a symbolic link for dotnet is a good practice as it avoids redundancy and ensures that updates to the SDK are reflected without needing to copy the binary again.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The change from cp to ln -s is appropriate for creating a symbolic link, which is generally preferred for executables to avoid redundancy and potential issues with updates.

Workflow ID: wflow_Zlnq06utSLE7wn0w


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 5575899 in 10 minutes and 37 seconds

More details
  • Looked at 383 lines of code in 6 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. backend/windmill-worker/src/handle_child.rs:440
  • Draft comment:
    The get_mem_peak function returns negative values for errors, which can be misleading. Consider using Option<i32> or Result<i32, Error> to handle errors more explicitly.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The function get_mem_peak is used in multiple places to fetch memory usage, but it returns negative values for errors. This can be misleading and should be handled more explicitly.
2. backend/windmill-worker/src/python_executor.rs:85
  • Draft comment:
    The get_mem_peak function returns negative values for errors, which can be misleading. Consider using Option<i32> or Result<i32, Error> to handle errors more explicitly. This applies to its usage in handle_python_reqs and other functions.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The get_mem_peak function is used in multiple places, including handle_python_reqs, to fetch memory usage. It returns negative values for errors, which can be misleading. This should be handled more explicitly.

Workflow ID: wflow_s6yZezT7OQQHi9jf


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on f3a4031 in 24 seconds

More details
  • Looked at 9 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. Dockerfile:201
  • Draft comment:
    Remove the unnecessary newline at the end of the file for consistency.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The extra newline at the end of the Dockerfile is unnecessary and should be removed for consistency and cleanliness.

Workflow ID: wflow_FYKV7lmnNX8JyAGK


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on e1d3737 in 26 seconds

More details
  • Looked at 9 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. Dockerfile:202
  • Draft comment:
    Remove the unnecessary trailing newline at the end of the file for consistency.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The Dockerfile has an unnecessary trailing newline at the end, which is not a major issue but can be cleaned up for consistency.

Workflow ID: wflow_RTmGGj5TLpuVgmm0


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 8a6a879 in 34 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 1 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/package.json:145
  • Draft comment:
    Ensure the version of windmill-parser-wasm-csharp is consistent with other windmill-parser-wasm-* dependencies for maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The addition of the C# parser dependency seems correct, but it's important to ensure consistency in versioning with other parsers.

Workflow ID: wflow_uNVx070i3uzkftCB


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on a3fad2c in 46 seconds

More details
  • Looked at 47 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. docker/DockerfileFull:6
  • Draft comment:
    The RUN pip3 install ansible command is duplicated. Consider consolidating it to avoid redundancy.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The RUN pip3 install ansible command is duplicated in both Dockerfiles. It should be consolidated to avoid redundancy.
2. docker/DockerfileFullEe:6
  • Draft comment:
    The RUN pip3 install ansible command is duplicated. Consider consolidating it to avoid redundancy.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The RUN pip3 install ansible command is duplicated in both Dockerfiles. It should be consolidated to avoid redundancy.

Workflow ID: wflow_DdYiAgH4pNLslR2h


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 4034431 in 49 seconds

More details
  • Looked at 7 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. backend/ee-repo-ref.txt:1
  • Draft comment:
    The change in this file is not mentioned in the PR description. Ensure this update is intentional and necessary.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The file ee-repo-ref.txt has been modified, but it only contains a single line with a hash. This change might be intentional to update a reference, but it's unclear without additional context. However, since the PR description doesn't mention this file, it's worth pointing out.

Workflow ID: wflow_YvDEUyrXxnGJWNvt


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 5d7240e in 26 seconds

More details
  • Looked at 23 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. .github/DockerfileBackendTests:56
  • Draft comment:
    Consider using a specific version of the dotnet-sdk directly in the Dockerfile to ensure consistency and avoid potential issues with image updates.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_3oOC1BWsRje5StJp


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 02dccdb in 50 seconds

More details
  • Looked at 262 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. backend/windmill-worker/src/csharp_executor.rs:82
  • Draft comment:
    Consider ensuring that the nuget.config file is only deleted if it was successfully created and used. This can prevent potential issues if an error occurs between creation and deletion.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code in csharp_executor.rs is handling the creation and deletion of a nuget.config file. However, the deletion process is not atomic and could potentially leave the file in an inconsistent state if an error occurs between creation and deletion. This could be improved by ensuring that the file is only deleted if it was successfully created and used.
2. frontend/src/lib/components/InstanceSetting.svelte:184
  • Draft comment:
    Ensure SimpleEditor properly handles edge cases like large inputs or invalid syntax for codearea field type.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The InstanceSetting.svelte file includes a new codearea field type for settings. This is a good addition for handling code-like settings, but ensure that the SimpleEditor component is properly handling all edge cases, such as large inputs or invalid syntax.
3. frontend/src/lib/components/instanceSettings.ts:263
  • Draft comment:
    Ensure nuget_config setting is properly validated and sanitized to prevent XML injection or other security issues.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_ZxHADa9SvuIr7F4w


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 16712bd in 33 seconds

More details
  • Looked at 93 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. backend/tests/worker.rs:1801
  • Draft comment:
    The C# test is commented out. Ensure this test is completed and uncommented to verify C# support.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_uo9uayNyKDhtmLDp


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@wendrul wendrul changed the title WIP: feat: add C# support feat: add C# support Dec 12, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 9a16e3f in 59 seconds

More details
  • Looked at 225 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_3z7CPE4wjyxoPTn2


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@rubenfiszel rubenfiszel merged commit c85d2a4 into main Dec 12, 2024
3 of 4 checks passed
@rubenfiszel rubenfiszel deleted the win-444-add-support-for-csharp-c branch December 12, 2024 23:29
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2024
@wendrul wendrul restored the win-444-add-support-for-csharp-c branch December 12, 2024 23:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants