Skip to content

Commit 638faf0

Browse files
yatarkanapaniukov
andauthored
[VSCode Extension] Add missing files & Configure CI (#748)
* Add missed media directory * Disable azure pipelines for openvino code module * Specify ci workflow path for token merging module * Add ci workflow for openvino code module * Enable extension workflow for forks * Add cache dependency path for extension workflow * Add missing files * Review fixes --------- Co-authored-by: Artur Paniukov <[email protected]>
1 parent f6eb6af commit 638faf0

File tree

14 files changed

+426
-2
lines changed

14 files changed

+426
-2
lines changed

.ci/azure/linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ trigger:
66
paths:
77
exclude:
88
- modules/nvidia_plugin
9+
- modules/openvino_code
910

1011
pr:
1112
branches:
@@ -15,6 +16,7 @@ pr:
1516
paths:
1617
exclude:
1718
- modules/nvidia_plugin
19+
- modules/openvino_code
1820

1921
resources:
2022
repositories:

.ci/azure/linux_cuda.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ trigger:
77
include:
88
- modules/nvidia_plugin
99
- .ci/azure/linux_cuda.yml
10+
exclude:
11+
- modules/openvino_code
1012

1113
pr:
1214
branches:
@@ -16,6 +18,8 @@ pr:
1618
paths:
1719
include:
1820
- modules/nvidia_plugin
21+
exclude:
22+
- modules/openvino_code
1923

2024
resources:
2125
repositories:

.ci/azure/mac.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ trigger:
66
paths:
77
exclude:
88
- modules/nvidia_plugin
9+
- modules/openvino_code
910

1011
pr:
1112
branches:
@@ -15,6 +16,7 @@ pr:
1516
paths:
1617
exclude:
1718
- modules/nvidia_plugin
19+
- modules/openvino_code
1820

1921
resources:
2022
repositories:

.ci/azure/windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ trigger:
66
paths:
77
exclude:
88
- modules/nvidia_plugin
9+
- modules/openvino_code
910

1011
pr:
1112
branches:
@@ -15,6 +16,7 @@ pr:
1516
paths:
1617
exclude:
1718
- modules/nvidia_plugin
19+
- modules/openvino_code
1820

1921
resources:
2022
repositories:

.github/workflows/openvino_code.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: OpenVINO Code Extension Workflow
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
paths:
7+
- 'modules/openvino_code/**'
8+
- '.github/workflows/openvino_code.yml'
9+
10+
concurrency:
11+
group: ${{ github.head_ref || github.ref_name }}-openvino_code
12+
cancel-in-progress: true
13+
14+
defaults:
15+
run:
16+
working-directory: ./modules/openvino_code
17+
18+
jobs:
19+
check_extension:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Use Node.js 16.x
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: '16.x'
29+
cache: 'npm'
30+
cache-dependency-path: modules/openvino_code/package-lock.json
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Run Lint
36+
run: npm run lint:all
37+
38+
check_server:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Python 3.8
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: '3.8'
48+
cache: 'pip'
49+
50+
- name: Install dependencies
51+
run: pip install ruff black
52+
53+
- name: Lint with ruff and Black
54+
run: |
55+
cd server
56+
ruff check .
57+
black --check .

.github/workflows/token_merging.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ name: Token Merging - Test
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches:
6+
- master
7+
paths:
8+
- 'modules/token_merging/**'
69
pull_request:
7-
branches: [ master ]
10+
branches:
11+
- master
12+
paths:
13+
- 'modules/token_merging/**'
814

915
concurrency:
1016
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

modules/openvino_code/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ venv
2626
/server/OVCodExtServer.egg-info/
2727
/server/src/OVCodExtServer.egg-info/
2828
/server/.ruff_cache/
29+
30+
!media/*.png

modules/openvino_code/media/logo.png

6.51 KB
Loading
930 Bytes
Loading
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Disposable, ExtensionContext, commands, window, languages } from 'vscode';
2+
import { COMMANDS } from '../constants';
3+
import { IExtensionComponent } from '../extension-component.interface';
4+
import { notificationService } from '../services/notification.service';
5+
import { extensionState } from '../state';
6+
import { CommandInlineCompletionItemProvider } from './command-inline-completion-provider';
7+
8+
class InlineCompletion implements IExtensionComponent {
9+
private _disposables: Disposable[] = [];
10+
11+
activate(context: ExtensionContext): void {
12+
// Register Inline Completion triggered by command
13+
const commandInlineCompletionProvider = new CommandInlineCompletionItemProvider();
14+
15+
let commandInlineCompletionDisposable: Disposable;
16+
17+
const generateCommandDisposable = commands.registerCommand(COMMANDS.GENERATE_INLINE_COPMLETION, () => {
18+
if (!extensionState.get('isServerAvailable')) {
19+
notificationService.showServerNotAvailableMessage(extensionState.state);
20+
return;
21+
}
22+
if (extensionState.get('isLoading') && window.activeTextEditor) {
23+
void window.showTextDocument(window.activeTextEditor.document);
24+
return;
25+
}
26+
27+
extensionState.set('isLoading', true);
28+
29+
if (commandInlineCompletionDisposable) {
30+
commandInlineCompletionDisposable.dispose();
31+
}
32+
33+
commandInlineCompletionDisposable = languages.registerInlineCompletionItemProvider(
34+
{ pattern: '**' },
35+
commandInlineCompletionProvider
36+
);
37+
38+
void commandInlineCompletionProvider.triggerCompletion(() => {
39+
commandInlineCompletionDisposable.dispose();
40+
extensionState.set('isLoading', false);
41+
});
42+
});
43+
44+
const acceptCommandDisposable = commands.registerCommand(COMMANDS.ACCEPT_INLINE_COMPLETION, () => {
45+
void commands.executeCommand('editor.action.inlineSuggest.commit');
46+
});
47+
48+
context.subscriptions.push(generateCommandDisposable, acceptCommandDisposable);
49+
this._disposables.push(generateCommandDisposable, acceptCommandDisposable);
50+
}
51+
52+
deactivate(): void {
53+
this._disposables.forEach((disposable) => {
54+
disposable.dispose();
55+
});
56+
this._disposables = [];
57+
}
58+
}
59+
60+
export const inlineCompletion = new InlineCompletion();

0 commit comments

Comments
 (0)