In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to install and use the SOAR IDE plug-in, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
The following describes the basic implementation of the SOAR plug-in and the installation and use of the plug-ins that have now been implemented.
SOAR (SQL Optimizer And Rewriter) is Xiaomi's recent open source SQL intelligent optimization rewriting tool, which achieved 2000 + stars in the first week of open source. Our purpose of developing SOAR is not only to help DBA, but also to help SQL developers write high-quality SQL more easily. SOAR draws on the ideas of other SQLint [1] and provides three editor plug-ins that can be integrated into code editors such as Vim,Sublime Text,VS Code.
About lint Featur
When report-type is specified as lint, SOAR outputs the review content in the shape of SQLint. For ease of presentation, only a few information such as file name, line number, suggestion type, and suggestion summary are retained in lint mode. Here is a simple example.
$cat file.sql select * from test $soar-report-type lint-query file.sql file.sql:1:CLA.001
Outermost SELECT does not specify WHERE condition file.sql:1:COL.001 does not recommend using SELECT * type query
Vim plug-in Vim plug-in We have chosen to supplement the well-known Syntastic [2] plug-in, which requires users to install the Syntastic plug-in first. Its installation method is described in detail in the official document [3], so I will not repeat it here. Let's look directly at how to configure SOAR to take effect.
Make sure the soar binaries are under the executable lookup path $PATH
Make sure the soar binaries have executable permissions, chmod aquix soar
Copy the doc/example/soar.vim file in the source code to the ${SyntasticInstalledPath} / syntax_checkers/sql directory. For example, the author uses bundle to manage the Vim plug-in, so copy the soar.vim file to the ~ / .vim/bundle/pristine/syntastic/syntax_checkers/sql directory
Modify the ${SyntasticInstalledPath} / plugin/syntastic/registry.vim registration file to add inspection tools for sql type files, such as' sql': ['soar','sqlint']
Update Vim configuration ~ / .vimrc to allow Syntastic default pop-up window
Set statusline+=%#warningmsg# set statusline+=% {SyntasticStatuslineFlag ()} set statusline+=%* let g:syntastic_always_populate_loc_list = 1
Let g:syntastic_auto_loc_list = 1
Let g:syntastic_check_on_open = 1
Let g:syntastic_check_on_wq = 0
If all goes well, use Vim to open a file and you will see the advice given by SOAR every time you save it.
Sublime Text3 plug-in
In the same way as the Vim plug-in, in Sublime Text3, we chose to expand on the basis of SublimeLinter [4]. As the code has just been open source, SublimeLinter-soar [5] has not been merged in PackageControlChannel-related Pull Request [6], so it cannot be installed through the PackageControl that comes with Sublime Text3 for the time being.
Although you cannot install it in an easy way, if you want to experience SOAR's Sublime Text3 plug-in right away, you can install it manually as follows:
Make sure the soar binaries have executable permissions, chmod aquix soar
Install SublimeLinter according to official documentation [7]
Open the plugin-related directory of Sublime Text3: Preferences-> Browse Packages...
Download the code in this directory
Git clone https://github.com/liipx/SublimeLinter-soar.git
Configure personal related parameters: click Preferences-> PackageSettings-> SublimeLinter-> Settings, and add the following to your personal configuration after modification
/ / SublimeLinter Settings-User {"linters": {"soar": {"soar_path": "your_soar_path"},},}
After restarting Sublim Text3, open a SQL file and you will see the advice given by SOAR.
VS Code plug-in
The plug-in function of VS Code is very powerful, and Microsoft has adopted an implementation method called Language Server Protocol (LSP) for the functional expansion of language classes. This protocol standardizes the communication between language tools and code editors, and interested students can learn more about it through the official document [8].
SOAR's VS Code plug-in is currently managed on Github [9] and has not yet been released to Microsoft's application market. It cannot be installed directly on Microsoft's official web page. Students who want to try something new and have relevant experience in TypeScript and VS Code plug-in development can install and experience the plug-in manually in the following ways. Other students can quietly wait for Microsoft application market approval to enjoy the convenience of one-click installation.
Make sure the soar binaries have executable permissions, chmod aquix soar
Make sure the soar binaries are under the executable lookup path $PATH
Find the VS Code plug-in installation path. The Mac/Linux user is generally ${HOME} / .vscode / extensions,Windows. The user is generally% USERPROFILE%\ .vscode\ extensions.
Enter the path to download the code
Git clone https://github.com/liipx/vscode-extension-soar
Refer to the project README [10] to compile TypeScript programs in Client and Server directories
Restart VS Code and open a SQL file to see if it works.
On how to install and use the SOAR IDE plug-in to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.