Skip to content
Open
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
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
"prettier",
],
globals: {
Atomics: 'readonly',
Expand All @@ -20,7 +21,7 @@ module.exports = {
},
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'prettier/prettier': 'error',
'prettier/prettier': ['error', { "endOfLine": "auto" }, { usePrettierrc: true }],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/prefer-namespace-keyword': 'off',
Expand Down
4 changes: 0 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"eslint.enable": true,
"files.associations": {
"iostream": "cpp"
},
"editor.formatOnSave": true
}
Binary file modified docs/img/templateSettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
110 changes: 58 additions & 52 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,59 @@
# cph user guide
# CPH User Guide

This document contains instructions on how to use this extension.
This document contains instructions on how to use this extension. UI information
can be found in the README.

## UI explained

![Basic Usage](img/user-guide-image.png)

This image is outdated. Please refer to README for an updated UI. The button
actions remain the same.

## Using with competitive companion
## Using competitive companion

1. [Install cph](https://marketplace.visualstudio.com/items?itemName=DivyanshuAgrawal.competitive-programming-helper)
by following the instructions given in the link.

1. [Install competitive companion](https://github.com/jmerle/competitive-companion#readme)
2. [Install competitive companion](https://github.com/jmerle/competitive-companion#readme)
browser extension in your browser, using the instructions given in the link.

1. Open any folder in VS Code (Menu>File>Open Folder).

1. Use Companion by pressing the green plus (+) circle from the browser toolbar
3. Open any folder in VS Code (Menu>File>Open Folder).
4. Use Companion by pressing the green plus (+) circle from the browser toolbar
when visiting any problem page.

![Activate Companion](img/activate-companion.png)
![Activate Companion](img/activate-companion.png)

1. The file opens in VS Code with testcases preloaded. Press `Ctrl+Alt+B` to run
them. Or, use the 'Run Testcases' button from the activity bar ( in the
them. Or, use the 'Run Testcases' button from the activity bar (in the
bottom).

## Using with your own problems
## Making your own problems

1. Write some code in any supported language ( .cpp, .c, .rs, .python).
2. Launch the extension: Press `Ctrl+Alt+B` to run them. Or, use the 'Run
Testcases' button from the activity bar (in the bottom).
3. Enter your testcases in the window opened to the side.
4. Then, you can run them.

1. Launch the extension: Press `Ctrl+Alt+B` to run them. Or, use the 'Run
Testcases' button from the activity bar ( in the bottom).

1. Enter your testcases in the window opened to the side.

1. Then, you can run them.

## Submit to Codeforces
## Submitting to Codeforces

1. Install [cph-submit](https://github.com/agrawal-d/cph-submit) on Firefox.
1. After installing, make sure a browser window is open.
1. Click on the 'Submit to CF' button in the results window.
1. A tab opens in the browser and the problem is submitted.
2. After installing, make sure a browser window is open.
3. Click on the 'Submit to CF' button in the results window.
4. A tab opens in the browser and the problem is submitted.

## Submit to Kattis

1. Install Kattis [config file](https://open.kattis.com/download/kattisrc) and
[submission client](https://github.com/Kattis/kattis-cli). Make
sure you are logged in on another tab prior to accessing the files.

[submission client](https://github.com/Kattis/kattis-cli). Make sure you are
logged in on another tab prior to accessing the files.
2. Move these files to a directory(folder) called .kattisrc in your home
directory.

1. On MacOS, this is typically /Users/{username}/.kattisrc
2. On Linux, this is typically /home/{username}/.kattisrc
3. On Windows, this is typically C:\Users\\{username}\\.kattisrc
> On MacOS, this is typically /Users/{username}/.kattisrc On Linux, this is
> typically /home/{username}/.kattisrc On Windows, this is typically
> C:\Users\\{username}\\.kattisrc

3. If any errors come up, check which directory `~` is linked to, by running

```bash
python -c "import os; print(os.path.expanduser('~'))"
```

in a terminal.

`python -c "import os; print(os.path.expanduser('~'))"` in a terminal.
4. Click on the 'Submit to Kattis' button in the results window.

5. A new tab will open in the browser with the submissions page.

## Environment

- For C++, `DEBUG` and `CPH` are defined as a `#define` directive.
For C++, `DEBUG` and `CPH` are defined as a `#define` directive.

## Customizing preferences

Expand All @@ -85,7 +65,6 @@ Several options are available to customize the extension. Open VS Code settings

### General Settings

\
![Preferences](img/generalSettings.png)

- Default save location for generated meta-data.
Expand All @@ -97,7 +76,6 @@ Several options are available to customize the extension. Open VS Code settings

### Language Settings (for each language)

\
![Preferences](img/languageSettings.png)

- Additional compilation flags.
Expand All @@ -106,12 +84,40 @@ Several options are available to customize the extension. Open VS Code settings
- [Python] Command used to run python files. For eg. py, python3, pypy3, etc.

## Default Language Templates
- The path of the template that will be loaded when a new file of the default language is created by Competitive Companion
- For Java Users, the template shall be in the format where class name is `CLASS_NAME` as the file name so that CLASS_NAME in the code gets auto replaced.
\
![Templates](img/templateSettings.png)
![Templates](img/javaTemplate.png)

- Support for multiple template files for each language and default templates
(by only putting a single template for any given language)
- In your `settings.json` file, insert your template file paths as shown
below. Your file paths must use either double backslashes or forward slashes
to be valid. (e.g.
`"path": "C:/Users/lunarzDev/CompetitiveProgramming/Templates/Template.cpp"`)
- For Java templates, please name the class `CLASS_NAME,` so it can be
properly assigned to the same name as the file. Please note that the Java
file name may be something other than `CLASS_NAME`, so you can create
multiple unique templates.

```json
"cph.general.templatePaths": {
"cpp": [
{
"label": "Template Name 1",
"path": "<path-to-your-cpp-template>"
},
{
"label": "Template Name 2",
"path": "<path-to-your-cpp-template>"
}
],
"java": [
{
"label": "Default Java Template",
"path": "<path-to-your-java-template>"
}
]
}
```

![Templates](img/templateSettings.png)

## Getting help

Expand Down
Loading