* Add csharp stuff and merge after the rewrite
* Add csharp, boilerplate + minimal execution
* Add initial parser
* Frontend + wasm export of the tree sitter parser
* Arg spread and use cache
* More types and req parsing
* Add logo
* Parse async and void to fit the wrapper to the main sig
* Csharp editor resource and var buttons
* Lockfile generation
* Add default parsing using serde_json::from_str
* Update init code for c#
* Nsjail for c#
* Remove c_variadic feature
* Remove unused imports
* Add c_variadic only for wasm32 assembly
* Fix c# test
* Add dotnet to the images
* Update dockerfiles
* Update dockerfile again
* Touch Dockerfile
* npm install c# parser
* Add opt mount in nsjail
* Update ee repo ref
* Add csharp to backend image for tests
* Add setting to set nuget package
* Windows compatibility
* Disable csharp test
* ADd feature flag
98 lines
2.5 KiB
Svelte
98 lines
2.5 KiB
Svelte
<script lang="ts">
|
|
import Highlight, { LineNumbers } from 'svelte-highlight'
|
|
import python from 'svelte-highlight/languages/python'
|
|
import typescript from 'svelte-highlight/languages/typescript'
|
|
import go from 'svelte-highlight/languages/go'
|
|
import shell from 'svelte-highlight/languages/shell'
|
|
import graphql from 'svelte-highlight/languages/graphql'
|
|
import javascript from 'svelte-highlight/languages/javascript'
|
|
import sql from 'svelte-highlight/languages/sql'
|
|
import powershell from 'svelte-highlight/languages/powershell'
|
|
import php from 'svelte-highlight/languages/php'
|
|
import rust from 'svelte-highlight/languages/rust'
|
|
import csharp from 'svelte-highlight/languages/csharp'
|
|
import yaml from 'svelte-highlight/languages/yaml'
|
|
import type { Script } from '$lib/gen'
|
|
import { Button } from './common'
|
|
import { copyToClipboard } from '$lib/utils'
|
|
import { ClipboardCopy } from 'lucide-svelte'
|
|
import HighlightTheme from './HighlightTheme.svelte'
|
|
|
|
export let code: string = ''
|
|
export let language: Script['language'] | 'bunnative' | 'frontend' | undefined
|
|
export let lines = false
|
|
|
|
function getLang(lang: Script['language'] | 'bunnative' | 'frontend' | undefined) {
|
|
switch (lang) {
|
|
case 'python3':
|
|
return python
|
|
case 'deno':
|
|
return typescript
|
|
case 'nativets':
|
|
return typescript
|
|
case 'bun':
|
|
return typescript
|
|
case 'bunnative':
|
|
return typescript
|
|
case 'go':
|
|
return go
|
|
case 'bash':
|
|
return shell
|
|
case 'frontend':
|
|
return javascript
|
|
case 'graphql':
|
|
return graphql
|
|
case 'mysql':
|
|
return sql
|
|
case 'postgresql':
|
|
return sql
|
|
case 'snowflake':
|
|
return sql
|
|
case 'bigquery':
|
|
return sql
|
|
case 'powershell':
|
|
return powershell
|
|
case 'php':
|
|
return php
|
|
case 'rust':
|
|
return rust
|
|
case 'csharp':
|
|
return csharp
|
|
case 'ansible':
|
|
return yaml;
|
|
default:
|
|
return typescript
|
|
}
|
|
}
|
|
|
|
$: lang = getLang(language)
|
|
</script>
|
|
|
|
<HighlightTheme />
|
|
|
|
<div class="relative overflow-x-auto">
|
|
<Button
|
|
wrapperClasses="absolute top-2 right-2 z-20"
|
|
on:click={() => copyToClipboard(code)}
|
|
color="light"
|
|
size="xs2"
|
|
startIcon={{
|
|
icon: ClipboardCopy
|
|
}}
|
|
iconOnly
|
|
/>
|
|
{#if code?.length < 10000}
|
|
{#if !lines}
|
|
<Highlight class="nowrap {$$props.class}" language={lang} {code} />
|
|
{:else}
|
|
<Highlight class="nowrap {$$props.class}" language={lang} {code} let:highlighted>
|
|
<LineNumbers {highlighted} />
|
|
</Highlight>
|
|
{/if}
|
|
{:else}
|
|
<pre class="overflow-auto max-h-screen text-xs {$$props.class}"
|
|
><code class="language-{language}">{code}</code></pre
|
|
>
|
|
{/if}
|
|
</div>
|