Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions docs/.vitepress/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<MonacoEditor
:value="props.modelValue"
@update:value="(val: string) => $emit('update:modelValue', val)"
:language="lang ?? 'zapConfig'"
:language="lang ?? 'zapConfig'"
:theme="`${props.isCodeBlock ? 'codeblock' : 'tab'}-${isDark ? 'dark' : 'light'}`"
@beforeMount="beforeMount"
@mount="(editor) => $emit('mounted', editor)"
:options="EDITOR_OPTIONS"
/>
</template>
/>
</template>

<script setup lang="ts">
import MonacoEditor from "@guolao/vue-monaco-editor";
Expand Down Expand Up @@ -110,7 +110,7 @@ const beforeMount = (monaco: Monaco) => {

const Calls = ["SingleSync", "SingleAsync", "ManySync", "ManyAsync", "Polling"] as const;

const Options = ["write_checks", "typescript", "typescript_max_tuple_length", "typescript_enum", "manual_event_loop", "remote_scope", "remote_folder", "server_output", "client_output", "casing", "yield_type", "async_lib", "tooling", "tooling_output", "tooling_show_internal_data", "disable_fire_all", "types_output", "call_default"] as const;
const Options = ["write_checks", "typescript", "typescript_max_tuple_length", "typescript_enum", "manual_event_loop", "include_profile_labels", "remote_scope", "remote_folder", "server_output", "client_output", "casing", "yield_type", "async_lib", "tooling", "tooling_output", "tooling_show_internal_data", "disable_fire_all", "types_output", "call_default"] as const;

const TypeScriptEnum = ["StringLiteral", "ConstEnum", "StringConstEnum"].map((value) => `"${value}"`)
const Casing = ["PascalCase", "camelCase", "snake_case"].map((value) => `"${value}"`);
Expand Down Expand Up @@ -167,6 +167,7 @@ const beforeMount = (monaco: Monaco) => {

write_checks: Operators,
manual_event_loop: Operators,
include_profile_labels: Operators,

remote_scope: [],
remote_folder: [],
Expand Down
17 changes: 17 additions & 0 deletions docs/config/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,23 @@ Note that Zap uses `RunService.Heartbeat` and a 61 hz rate by default.

<CodeBlock code="opt manual_event_loop = true" />

## `include_profile_labels`

When enabled, microprofiler lables are added to the generated file to diagnose performance issues.

### Default

`false`

### Options

- `true`
- `false`

### Example

<CodeBlock code="opt include_profile_labels = true" />

## `typescript_max_tuple_length`

The maximum non-nested length of tuples Zap can generate, with anything longer generating an array.
Expand Down
5 changes: 5 additions & 0 deletions polyfill.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ globals:
- type: any
- required: false
type: '...'
debug.profilebegin:
args:
- type: string
debug.profileend:
args: []
structs:
DataModel:
GetService:
Expand Down
21 changes: 21 additions & 0 deletions zap/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub struct Config<'src> {

pub write_checks: bool,
pub manual_event_loop: bool,
pub include_profile_labels: bool,

pub remote_scope: &'src str,
pub remote_folder: &'src str,
Expand Down Expand Up @@ -215,6 +216,16 @@ pub struct FnDecl<'src> {
pub path: Vec<&'src str>,
}

impl<'src> FnDecl<'src> {
pub fn display_path(&self) -> String {
if self.path.is_empty() {
self.name.to_string()
} else {
format!("{}.{}", self.path.join("."), self.name)
}
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FnCall {
Async,
Expand All @@ -232,6 +243,16 @@ pub struct EvDecl<'src> {
pub path: Vec<&'src str>,
}

impl<'src> EvDecl<'src> {
pub fn display_path(&self) -> String {
if self.path.is_empty() {
self.name.to_string()
} else {
format!("{}.{}", self.path.join("."), self.name)
}
}
}

#[derive(Debug, Clone)]
pub struct Parameter<'src> {
pub name: Option<&'src str>,
Expand Down
Loading
Loading