Skip to content

Commit b13ed38

Browse files
apaniukovyatarkan
andauthored
Update OV Version (openvinotoolkit#729)
* Update OV Version to Release * Add GIFs to README.md * Delete vsix from the repo * Add Platform Specific Hotkeys and Show Selected Quote Style on the Side Panel --------- Co-authored-by: Yaroslav Tarkan <yaroslav.tarkan@intel.com>
1 parent cabe453 commit b13ed38

File tree

11 files changed

+29
-15
lines changed

11 files changed

+29
-15
lines changed

modules/openvino_code/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ To check the connection manually, use the `Check Connection` button located on t
2323

2424
### Code Completion
2525

26+
![code_completion](https://github.com/apaniukov/openvino_contrib/assets/51917466/c3ba73bf-106b-4045-a36e-96440f8c804f)
27+
2628
1. Create a new Python file or open an existing one.
2729
1. Type `def main():` or place the cursor where you'd like code suggestions to be generated.
28-
1. Press the keyboard shortcut `Ctrl+Alt+Space` or click the `Generate Code Completion` button located in the side panel.
30+
1. Press the keyboard shortcut `Ctrl+Alt+Space` (`Cmd+Alt+Space` for macOS) or click the `Generate Code Completion` button located in the side panel.
2931
1. Use the `Tab` key to accept the entire suggestion or `Ctrl`+`Right Arrow` to accept it word by word. To decline the suggestion, press `Esc`.
3032

3133
You can customize the length of the generated code by adjusting `Max New Tokens` and `Min New Tokens` parameters in the extension settings.
@@ -36,6 +38,8 @@ This mode allows you to immediately receive model output and avoid problems with
3638

3739
### Summarization via Docstring Generation
3840

41+
![summarization](https://github.com/apaniukov/openvino_contrib/assets/51917466/1d066b0e-cff7-4353-90f9-a53343d60b59)
42+
3943
To generate function docstring start typing `"""` or `'''` right under function signature and choose `Generate Docstring`.
4044
You can select the desired type of quotes in the extension settings.
4145

Binary file not shown.

modules/openvino_code/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/openvino_code/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"publisher": "OpenVINO",
33
"name": "openvino-code-completion",
4-
"version": "0.0.4",
4+
"version": "0.0.5",
55
"displayName": "OpenVINO Code Completion",
66
"description": "VSCode extension for AI code completion with OpenVINO",
77
"icon": "media/logo.png",

modules/openvino_code/server/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies = [
1111
'torch @ https://download.pytorch.org/whl/cpu-cxx11-abi/torch-2.0.1%2Bcpu.cxx11.abi-cp310-cp310-linux_x86_64.whl ; sys_platform=="linux" and python_version == "3.10"',
1212
'torch @ https://download.pytorch.org/whl/cpu-cxx11-abi/torch-2.0.1%2Bcpu.cxx11.abi-cp311-cp311-linux_x86_64.whl ; sys_platform=="linux" and python_version == "3.11"',
1313
'torch ; sys_platform != "linux"',
14-
'openvino==2023.1.0.dev20230811',
14+
'openvino==2023.1.0',
1515
'transformers==4.31.0',
1616
'optimum==1.12.0',
1717
'optimum-intel[openvino]==1.10.1',

modules/openvino_code/shared/extension-state.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ export interface IExtensionState {
2020
get isServerAvailable(): boolean;
2121
get config(): ExtensionConfiguration;
2222
features: IStateFeatures;
23+
platform: NodeJS.Platform;
2324
}

modules/openvino_code/side-panel-ui/src/App.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ function App(): JSX.Element {
2929
<ServerSection state={state}></ServerSection>
3030
{isServerStarted && (
3131
<>
32-
<CompletionSection isLoading={state?.isLoading}></CompletionSection>
33-
{isSummarizationSupported && <SummarizationSection></SummarizationSection>}
32+
<CompletionSection isLoading={state?.isLoading} platform={state?.platform}></CompletionSection>
33+
{isSummarizationSupported && (
34+
<SummarizationSection quoteStyle={state?.config.quoteStyle}></SummarizationSection>
35+
)}
3436
</>
3537
)}
3638
<ActionsSection></ActionsSection>

modules/openvino_code/side-panel-ui/src/components/sections/CompletionSection/CompletionSection.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@ import { VscodeIcon } from '../../shared/VscodeIcon/VscodeIcon';
55

66
interface CompletionSectionProps {
77
isLoading: boolean;
8+
platform: NodeJS.Platform;
89
}
910

10-
export function CompletionSection({ isLoading }: CompletionSectionProps = { isLoading: false }): JSX.Element {
11+
export function CompletionSection({ isLoading, platform }: CompletionSectionProps): JSX.Element {
1112
const handleGenerateClick = () => {
1213
vscode.postMessage({
1314
type: SidePanelMessageTypes.GENERATE_COMPLETION_CLICK,
1415
});
1516
};
1617

18+
const platformKeyBinding = platform === 'darwin' ? 'Cmd+Alt+Space' : 'Ctrl+Alt+Space';
19+
1720
return (
1821
<section className="completion-section">
1922
<h3>Code Completion</h3>
2023
<span>
21-
{/* TODO Detect OS and show specific keybindings */}
2224
{/* TODO Consider getting keybinding from package.json */}
23-
To generate inline code completion use combination <kbd>Ctrl+Alt+Space</kbd> or press the button below.
25+
To generate inline code completion use combination <kbd>{platformKeyBinding}</kbd> or press the button below.
2426
</span>
2527
<br />
2628
<button className="generate-button" onClick={handleGenerateClick} disabled={isLoading}>

modules/openvino_code/side-panel-ui/src/components/sections/SummarizationSection/SummarizationSection.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
export function SummarizationSection(): JSX.Element {
1+
interface SummarizationSectionProps {
2+
quoteStyle: string;
3+
}
4+
5+
export function SummarizationSection({ quoteStyle }: SummarizationSectionProps): JSX.Element {
26
return (
37
<section className="summarization-section">
48
<h3>Summarization</h3>
59
<span>
6-
{/* TODO Consider geting selected docstring quotes from extension settings */}
7-
To use summarization for docstrings, start typing docstring quotes (<code>&quot;&quot;&quot;</code> by default).
10+
To use summarization for docstrings, start typing docstring quotes (<code>{quoteStyle}</code>).
811
</span>
912
</section>
1013
);

modules/openvino_code/src/configuration.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export type CustomConfiguration = {
2222
endToken: string;
2323
stopToken: string;
2424
} & {
25-
quoteStyle?: string;
26-
docstringFormat?: string;
25+
quoteStyle: string;
26+
docstringFormat: string;
2727
};
2828

2929
export type ExtensionConfiguration = WorkspaceConfiguration & CustomConfiguration;

modules/openvino_code/src/state.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { IExtensionState, ConnectionStatus } from '@shared/extension-state';
77
import { INITIAL_SERVER_STATE, ServerStatus } from '@shared/server-state';
88
import { MODEL_SUPPORTED_FEATURES } from '@shared/model';
99
import { Features } from '@shared/features';
10+
import { platform } from 'process';
1011

1112
class ExtensionState implements IExtensionComponent {
1213
private readonly _state: IExtensionState = {
@@ -28,6 +29,7 @@ class ExtensionState implements IExtensionComponent {
2829
return this.supportedList.includes(Features.SUMMARIZATION);
2930
},
3031
},
32+
platform,
3133
};
3234

3335
private _emitter = new EventEmitter();

0 commit comments

Comments
 (0)