Skip to content

Commit

Permalink
Merge pull request #1180 from posit-dev/dotnomad/vscode-format
Browse files Browse the repository at this point in the history
Run prettier format on vscode extension
  • Loading branch information
sagerb authored Mar 21, 2024
2 parents b1848ee + 213d7a1 commit ef1b4ea
Show file tree
Hide file tree
Showing 54 changed files with 2,206 additions and 1,817 deletions.
15 changes: 3 additions & 12 deletions extensions/vscode/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"prettier"
],
"plugins": ["@typescript-eslint"],
"extends": ["prettier"],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
Expand All @@ -19,10 +15,5 @@
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts",
"api"
]
"ignorePatterns": ["out", "dist", "**/*.d.ts", "api"]
}
8 changes: 3 additions & 5 deletions extensions/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"]
}
50 changes: 22 additions & 28 deletions extensions/vscode/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,26 @@
// 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}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
6 changes: 2 additions & 4 deletions extensions/vscode/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"cSpell.words": [
"mutexify"
],
"cSpell.words": ["mutexify"],
"svg.preview.background": "editor",
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.detectIndentation": false
}
}
32 changes: 16 additions & 16 deletions extensions/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
}
}
]
}
12 changes: 6 additions & 6 deletions extensions/vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
Install the extension.
[https://cdn.posit.co/publisher/releases/tags/v0.0.alpha2/publisher-0.0.alpha2.vsix](https://cdn.posit.co/publisher/releases/tags/v0.0.alpha2/publisher-0.0.alpha2.vsix).

To learn how to install a `.vsix` file, see the [*Install from a VSIX*](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix) guide from Visual Studio Code.
To learn how to install a `.vsix` file, see the [_Install from a VSIX_](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix) guide from Visual Studio Code.

## Tutorial

Once installed, open *Posit Publisher* by clicking the icon in the editor menu bar.
Once installed, open _Posit Publisher_ by clicking the icon in the editor menu bar.

![](https://cdn.posit.co/publisher/assets/img/tutorial.png)

## Command Pallette Commands

### Posit: Open Publisher

This command opens *Posit Publisher* in a new window or focuses on an existing window.
This command opens _Posit Publisher_ in a new window or focuses on an existing window.

This command invokes the same action as clicking the *Posit Publisher* icon.
This command invokes the same action as clicking the _Posit Publisher_ icon.

### Posit: Close Publisher

This command closes *Posit Publisher* and shuts down the server.
This command closes _Posit Publisher_ and shuts down the server.

## Configuration

### `posit.publisher.executable.path`

By default, the extension uses the bundled Posit Publisher binary executable. To override this behavior, configure the `posit.publisher.executable.path` property in your *User* or *Workspace* settings.
By default, the extension uses the bundled Posit Publisher binary executable. To override this behavior, configure the `posit.publisher.executable.path` property in your _User_ or _Workspace_ settings.

![](https://cdn.posit.co/publisher/assets/img/settings.png)
8 changes: 4 additions & 4 deletions extensions/vscode/src/api/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# API Wrapper Library
# API Wrapper Library

A library to enable convenient access to the Publisher Client API and its
response types.

## Usage

```typescript
import { useApi } from 'src/api';
import { useApi } from "src/api";

const api = useApi();

Expand All @@ -22,7 +22,7 @@ using `setBaseUrl`. This changes the client so all requests will use the new
base URL. This will need to be done before any requests are made.

```typescript
api.setBaseUrl('http://localhost:9000/api');
api.setBaseUrl("http://localhost:9000/api");
```

## Organization
Expand Down Expand Up @@ -73,4 +73,4 @@ try {
} catch (err) {
// handle the error
}
```
```
6 changes: 3 additions & 3 deletions extensions/vscode/src/api/axios.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (C) 2023 by Posit Software, PBC.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { AxiosRequestConfig } from 'axios';
import { AxiosRequestConfig } from "axios";

declare module 'axios' {
declare module "axios" {
interface AxiosRequestConfig {
ignoreCamelCase?: string[]
ignoreCamelCase?: string[];
}
}
16 changes: 8 additions & 8 deletions extensions/vscode/src/api/client.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (C) 2023 by Posit Software, PBC.

import axios from 'axios';
import axios from "axios";

import { Accounts } from './resources/Accounts';
import { Deployments } from './resources/Deployments';
import { Configurations } from './resources/Configurations';
import { Files } from './resources/Files';
import { Requirements } from './resources/Requirements';
import { Accounts } from "./resources/Accounts";
import { Deployments } from "./resources/Deployments";
import { Configurations } from "./resources/Configurations";
import { Files } from "./resources/Files";
import { Requirements } from "./resources/Requirements";

class PublishingClientApi {
private client;
Expand All @@ -19,7 +19,7 @@ class PublishingClientApi {

constructor() {
this.client = axios.create({
baseURL: '/api',
baseURL: "/api",
});

this.accounts = new Accounts(this.client);
Expand All @@ -36,4 +36,4 @@ class PublishingClientApi {

export const api = new PublishingClientApi();

export const useApi = () => api;
export const useApi = () => api;
14 changes: 7 additions & 7 deletions extensions/vscode/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (C) 2023 by Posit Software, PBC.

export { api as default, useApi } from './client';
export { api as default, useApi } from "./client";

export * from './types/accounts';
export * from './types/configurations';
export * from './types/connect';
export * from './types/deployments';
export * from './types/events';
export * from './types/schema';
export * from "./types/accounts";
export * from "./types/configurations";
export * from "./types/connect";
export * from "./types/deployments";
export * from "./types/events";
export * from "./types/schema";
12 changes: 4 additions & 8 deletions extensions/vscode/src/api/resources/Accounts.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (C) 2023 by Posit Software, PBC.

import { AxiosInstance } from 'axios';
import { AxiosInstance } from "axios";

import { Account } from '../types/accounts';
import { Account } from "../types/accounts";

export class Accounts {
private client: AxiosInstance;
Expand All @@ -15,9 +15,7 @@ export class Accounts {
// 200 - success
// 500 - internal server error
getAll() {
return this.client.get<{ accounts: Account[] }>(
'/accounts',
);
return this.client.get<{ accounts: Account[] }>("/accounts");
}

// Returns:
Expand All @@ -26,8 +24,6 @@ export class Accounts {
// 500 - internal server error
get(accountName: string) {
const encodedAccountName = encodeURIComponent(accountName);
return this.client.get<Account>(
`/accounts/${encodedAccountName}`,
);
return this.client.get<Account>(`/accounts/${encodedAccountName}`);
}
}
8 changes: 4 additions & 4 deletions extensions/vscode/src/api/resources/Configurations.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (C) 2023 by Posit Software, PBC.

import { AxiosInstance } from 'axios';
import { AxiosInstance } from "axios";

import {
Configuration,
ConfigurationDetails,
ConfigurationError,
} from '../types/configurations';
} from "../types/configurations";

export class Configurations {
private client: AxiosInstance;
Expand All @@ -20,7 +20,7 @@ export class Configurations {
// 500 - internal server error
getAll() {
return this.client.get<Array<Configuration | ConfigurationError>>(
'/configurations',
"/configurations",
);
}

Expand Down Expand Up @@ -48,6 +48,6 @@ export class Configurations {
// 400 - bad request
// 500 - internal server error
inspect() {
return this.client.post<ConfigurationDetails[]>('/inspect');
return this.client.post<ConfigurationDetails[]>("/inspect");
}
}
Loading

0 comments on commit ef1b4ea

Please sign in to comment.