Solve PTA problems in VS Code
- English Document | 中文文档
⬇️ Install Pintia from Visual Studio Marketplace, VS Code (recommended) or Install from VSIX.
- Simply click
Sign in PTA
in thePintia Explorer
will let you sign in with your Pintia account. (Currently, only WeChat QR codes are supported for signin) - You can also use the following command to sign in/out:
- Pintia: Sign in
- Pintia: Sign out
-
Directly click on the problem to see the problem description.
⭐ Note:
- You can specify the path of the workspace folder to store the problem files by updating the setting
pintia.workspaceFolder
. The default value is:$HOME/.pintia/codes. - You can change the default language by triggering the command:
Pintia: Change Default Language
.
- You can specify the path of the workspace folder to store the problem files by updating the setting
-
The extension supports 3 editor shortcuts (aka Code Lens):
Submit
: Submit your answer to Pintia.Test
: Test your answer with customized test cases or default ones.Preview
: Open the problem preview in source files.
- You can put your codes between
@pintia code=start
and@pintia code=end
(enterptacode
to quickly add them). - Also, you can put your custom test samples between
@pintia test=start
and@pintia test=end
(enterptatest
to quickly add them). And then clickTest custom sample
to quickly test your code.
⭐ Note: Only the code wrapped between
@pintia code=start
and@pintia code=end
will be submitted to Pintia judge when you try to submit your codes by clickingsubmit
ortest
.
Click the Search
icon at the top of the Pintia
view or open the Command Palette
to use shortcut command Pintia: Search Problem
.
you can type ptanote
in the code editor to generate a note block, where you can enter your notes, and the next time you preview the problem, the notes will be parsed and previewed in Markdown.
⭐ Note: Your notes are submitted to PTA along with the code, not stored locally. After submitting the code, re-click
Preview
in the editor, or the next time you preview problems, your notes will be displayed on the preview page of the problem.
You can add the problem to the My Favorites
list by clicking the button on the right side of the problem. This feature does not depend on the official service, so you can only store the collected topics locally. The synchronization of data will be considered later using other methods.
You can enter the following prefixes in code editor to generate the corresponding code blocks quickly, as follows:
Prefix | Description |
---|---|
ptacode | Put your custom test samples in @pintia code=start/end and the extension will automatically recognize it when you click the Submit button. |
ptatest | Put your custom test samples in @pintia test=start/end and the extension will automatically recognize it when you click the Test button. |
ptacpp_stdc++ | Get the template of cpp with header file of bits/stdc++.h |
ptacpp_iostream | Get the template of cpp with header file of iostream |
ptaclang | Get the template of clang with header file of stdio.h |
ptajava_buffer | Get the template of java with BufferReader |
ptajava_scanner | Get the template of java with Scanner |
ptanote | Generate @pintia note=start/end block |
Use Ctrl+Shift+P
(in Windows) or Command+Shift+P
(in MacOS) to open the command panel and enter pintia
for quick access to the Pintia Extension
's related commands.
Command | Description | Note |
---|---|---|
pintia.clearCache |
Clear Cache | Use this command if the problem set information is different from the official one. |
pintia.signIn |
Sign In | |
pintia.signOut |
Sign Out | |
pintia.changeDefaultLanguage |
Change Default Language | Set any language supported by Pintia. |
pintia.changeWorkspaceFolder |
Change Workspace Folder | |
pintia.checkIn |
Check In PTA | It is recommended to set it to auto check-in in the settings. |
pintia.reportIssue |
Report Issue | |
pintia.searchProblem |
Search Problem | By default, ZOJ problem sets are ignored, which can be modified in the settings. |
pintia.refreshProblemSearchIndex |
Refresh Problem Search Index | To speed up data loading, data is cached locally. If you find missing problems, you can refresh. |
pintia.openWorkspace |
Open Pintia Workspace | |
pintia.clearViewedProblems |
Clear Problem Preview History | |
pintia.clearFavoriteProblems |
Clear My Favorites |
Setting Name | Description | Default Value |
---|---|---|
pintia.workspaceFolder |
Specify the path of the workspace folder to store the problem files. | "" |
pintia.defaultLanguage |
Default language for solving the problems. | C++ (g++) |
pintia.previewProblem.openAndCodeIt |
Specify whether to automatically open the code editor when previewing a problem. It is recommended not to set #pintia.previewProblem.defaultOpenedMethod# to Always Ask when enabled. |
false |
pintia.paging.pageSize |
Specify whether to page the problem list when the problem set is too large. It is not paged when pageSize is 0. | 100 |
pintia.autoCreateProblemSetFolder |
Specify whether to automatically create a problem set folder and place source code files in this directory when coding a problem. | true |
pintia.editor.shortcuts |
Customize the shortcuts in editors. | ["Submit", "Test", "Preview"] |
pintia.autoCheckIn |
Specify whether to automatically check in Pintia's education supermarket when the Pintia Extension is activated. | true |
pintia.file.problemFileNameFormat |
Set the naming format of the problem file. Supports variables: {label} (problem label), {title} (problem title), {pid} (problem ID), {psid} (problem set ID). |
{label} {title} |
pintia.file.replaceSpaceWithUnderscore |
Specify whether to replace spaces in problem file names with underscores. When enabled, "A1001 Hello World" will become "A1001_Hello_World". | false |
pintia.file.convertChineseCharacters |
Convert Chinese characters in the problem file name to pinyin and Chinese punctuation to English punctuation to avoid compilation or debugging issues with some compilers. | false |
pintia.file.customProblemSetName |
Customize the problem set folder name. Accepts a JSON string that maps the problem set ID to a custom name and has the highest priority. | {} |
pintia.searchIndex.ignoreZOJ |
Specify whether to ignore the problem set, ZOJ Problem Set, in the problem search index. | true |
pintia.searchIndex.ignoreLockedProblemSets |
Specify whether to ignore locked problem sets in the problem search index. | true |
pintia.problemHistoryListSize |
Specify the size of the problem preview history list. | 200 |
When you meet any problem, you can check out the Troubleshooting and FAQ first.
If your problem still cannot be addressed, feel free to file an issue.