Skip to content

Commit

Permalink
Update formatting for .ts and .json files in apps/vscode/ (#590)
Browse files Browse the repository at this point in the history
* Apply default formatting to `.ts` files

* Apply default formatting to `.json` files

* Apply more settings for final newlines and whitespace
  • Loading branch information
juliasilge authored Nov 1, 2024
1 parent 19771d4 commit 5919680
Show file tree
Hide file tree
Showing 72 changed files with 480 additions and 517 deletions.
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"editor.formatOnSave": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"editor.tabSize": 2
}
"editor.tabSize": 2,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true
}
38 changes: 16 additions & 22 deletions apps/vscode/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
}
2 changes: 1 addition & 1 deletion apps/vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
out/
*.vsix
*.vsix
8 changes: 3 additions & 5 deletions apps/vscode/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
}
30 changes: 13 additions & 17 deletions apps/vscode/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Server",
"port": 6009,
"restart": true,
"outFiles": ["${workspaceRoot}/out/**/*.js"]
},
]
}
]
}
20 changes: 10 additions & 10 deletions apps/vscode/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",

"editor.tabSize": 2
}
"editor.tabSize": 2
}
32 changes: 16 additions & 16 deletions apps/vscode/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
1 change: 0 additions & 1 deletion apps/vscode/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ src/**
**/*.map
**/*.ts
*.vsix

2 changes: 1 addition & 1 deletion apps/vscode/.yarnrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--ignore-engines true
--ignore-engines true
6 changes: 2 additions & 4 deletions apps/vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ The easiest way to install is directly from within VS Code (search extensions fo

You can also install from the [VS Code Extension Marketplace](https://marketplace.visualstudio.com/items?itemName=quarto.quarto), the [Open VSX Registry](https://open-vsx.org/extension/quarto/quarto) or directly from a [VISX extension file](#visx-install).


## Render and Preview

The Quarto VS Code extension includes commands and keyboard shortcuts for rendering Quarto documents (both standalone and within websites or books). After rendering, `quarto preview` is used behind the scenes to provide a preview pane within VS Code alongside your document:
Expand All @@ -44,7 +43,7 @@ When you execute **Preview Format**, you'll see a quick pick list of formats to

![](https://quarto.org/docs/tools/images/vscode-preview-format.png)

After previewing a different format, the **Quarto: Preview** command and <kbd>Ctrl+Shift+K</kbd> keyboard shortcut will be automatically rebound to the newly selected format for the duration of the current preview. To switch back to previewing the original format, use **Quarto: Preview Format** command again.
After previewing a different format, the **Quarto: Preview** command and <kbd>Ctrl+Shift+K</kbd> keyboard shortcut will be automatically rebound to the newly selected format for the duration of the current preview. To switch back to previewing the original format, use **Quarto: Preview Format** command again.

> Embedded preview is currently supported for HTML and PDF based formats (including `revealjs` and `beamer` slideshows). However, for Word and other formats you need to use an appropriate external program to preview the output.
Expand All @@ -64,7 +63,7 @@ However, you can configure the Quarto extension to automatically render whenever

You might also want to control this behavior on a per-document or per-project basis. If you include the `editor: render-on-save` option in your document or project YAML it will supersede whatever your VS Code setting is. For example:

``` yaml
```yaml
editor:
render-on-save: true
```
Expand All @@ -75,7 +74,6 @@ If you prefer to use an external browser for preview (or have no preview trigger
![](https://quarto.org/docs/tools/images/vscode-preview-settings.png)
## Code Cells
There are a variety of tools that make it easier to edit and execute
Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/assets/www/editor/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
index.js
style.css
style.css
2 changes: 1 addition & 1 deletion apps/vscode/language-configuration.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"comments": {
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": ["<!--", "-->"],
"blockComment": ["<!--", "-->"]
},
// symbols used as brackets
"brackets": [
Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/languages/dot/dot.configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
")"
]
]
}
}
2 changes: 1 addition & 1 deletion apps/vscode/languages/mermaid/mermaid.configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
")"
]
]
}
}
2 changes: 1 addition & 1 deletion apps/vscode/languages/mermaid/mermaid.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -883,4 +883,4 @@
}
},
"scopeName": "source.mmd"
}
}
2 changes: 1 addition & 1 deletion apps/vscode/languages/typst/typst.configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
")"
]
]
}
}
9 changes: 3 additions & 6 deletions apps/vscode/src/@types/hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ declare module 'positron' {

export interface PositronWindow {
createPreviewPanel(
viewType: string,
title: string,
preserveFocus?: boolean,
viewType: string,
title: string,
preserveFocus?: boolean,
options?: PreviewOptions
): PreviewPanel;
}
Expand Down Expand Up @@ -72,6 +72,3 @@ declare module 'positron' {
readonly previewPanel: PreviewPanel;
}
}



6 changes: 3 additions & 3 deletions apps/vscode/src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
export async function safeUpdateConfig(updateFn: () => Promise<void>) {
try {
await updateFn();
} catch(error) {
// if the user's settings.json file is corrupt/invalid this
} catch (error) {
// if the user's settings.json file is corrupt/invalid this
// will throw an exception and prevent loading of the extension
console.log("Unexpected error writing config (settings.json may be corrupt)");
}
}
}
2 changes: 1 addition & 1 deletion apps/vscode/src/core/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function quartoCanRenderMarkdown(document: vscode.TextDocument) {
export function quartoCanRenderScript(document: vscode.TextDocument) {
const text = document.getText();
return isJupyterPercentScript(document.uri.fsPath, text) ||
isKnitrSpinScript(document.uri.fsPath, text);
isKnitrSpinScript(document.uri.fsPath, text);
}

export function validatateQuartoCanRender(document: vscode.TextDocument) {
Expand Down
1 change: 0 additions & 1 deletion apps/vscode/src/core/hover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ export async function getSignatureHelpHover(
triggerCharacter
);
}

4 changes: 2 additions & 2 deletions apps/vscode/src/core/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export function vsCodeWebUrl(serverUrl: string) {
return rswURL(port);
} else if (isVSCodeServer()) {
return vsCodeServerProxyUri()!.replace("{{port}}", `${port}`);
}
}
}
// default to reflecting back serverUrl
return serverUrl;

}

export function rswURL(port: string) {
Expand Down
1 change: 0 additions & 1 deletion apps/vscode/src/core/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@ export function pythonIsCondaEnv(python: string) {
return false;
}
}

4 changes: 2 additions & 2 deletions apps/vscode/src/core/quarto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ import semver from "semver";
export async function configuredQuartoPath() {

const config = workspace.getConfiguration("quarto");

// explicitly configured trumps everything
const quartoPath = config.get("path") as string | undefined;
if (quartoPath) {
return quartoPath;
}

// if we can use pip quarto then look for it within the currently python (if its a venv/condaenv)
const usePipQuarto = config.get("usePipQuarto", true);
if (usePipQuarto) {
Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/src/core/schemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ export function hasFileScheme(uri: Uri) {
}

export function isOfScheme(scheme: string, link: string): boolean {
return link.toLowerCase().startsWith(scheme + ':');
return link.toLowerCase().startsWith(scheme + ':');
}
19 changes: 9 additions & 10 deletions apps/vscode/src/core/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface TerminalEnv {
QUARTO_R?: string;
}

export async function terminalEnv(uri?: Uri) : Promise<TerminalEnv> {
export async function terminalEnv(uri?: Uri): Promise<TerminalEnv> {

const env: TerminalEnv = {};

Expand Down Expand Up @@ -119,17 +119,17 @@ export function terminalCommand(command: string, context: QuartoContext, target?
}

export async function sendTerminalCommand(
terminal: Terminal,
terminalEnv: TerminalEnv,
context: QuartoContext,
terminal: Terminal,
terminalEnv: TerminalEnv,
context: QuartoContext,
cmd: string[]
) {

// create cmd text
const cmdText = context.useCmd
? `cmd /C"${cmd.join(" ")}"`
: cmd.join(" ");
? `cmd /C"${cmd.join(" ")}"`
: cmd.join(" ");

// show the terminal
terminal.show(true);

Expand Down Expand Up @@ -165,7 +165,7 @@ export async function killTerminal(name: string, before?: () => Promise<void>) {
}


function requiredTerminalDelay(env?: TerminalEnv) : number {
function requiredTerminalDelay(env?: TerminalEnv): number {
try {
if (env?.QUARTO_PYTHON) {
if (pythonIsVenv(env.QUARTO_PYTHON)) {
Expand All @@ -184,4 +184,3 @@ function requiredTerminalDelay(env?: TerminalEnv) : number {
return 0;
}
}

Loading

0 comments on commit 5919680

Please sign in to comment.