Skip to content

Commit

Permalink
Add setInterpreter command to environmentview's interpreter tree items
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan37 committed Mar 26, 2024
1 parent ee537fd commit 615c91a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
12 changes: 2 additions & 10 deletions src/views/activityBar/environmentView/EnvironmentDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied.See the License for the specific language governing
// permissions and limitations under the License.
import { EventEmitter, TreeDataProvider, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { EventEmitter, TreeDataProvider, TreeItem } from 'vscode';
import { State } from 'vscode-languageclient';
import { EventBus } from '../../../services/EventBus';
import { LSCLIENT_STATE_CHANGED, REFRESH_ENVIRONMENT_VIEW } from '../../../utils/constants';
import { EnvironmentItem } from './EnvironmentItem';
import {
createInterpreterDetails,
createLSClientItem,
createWorkspaceSettingsItems,
createZenMLStatusItems,
} from './viewHelpers';
import { LSCLIENT_STATE_CHANGED, REFRESH_ENVIRONMENT_VIEW } from '../../../utils/constants';

export class EnvironmentDataProvider implements TreeDataProvider<TreeItem> {
private static instance: EnvironmentDataProvider | null = null;
Expand Down Expand Up @@ -83,18 +83,10 @@ export class EnvironmentDataProvider implements TreeDataProvider<TreeItem> {
*/
private async createRootItems(): Promise<EnvironmentItem[]> {
const items: EnvironmentItem[] = [];

// Directly add the LS Client item
const lsClientStatusItem = createLSClientItem(this.lsClientStatus);
items.push(lsClientStatusItem);

// ZenML Status Items - assuming createZenMLStatusItems returns an array of EnvironmentItem
items.push(...(await createZenMLStatusItems()));

// Interpreter Details - assuming createInterpreterDetails returns an array of EnvironmentItem
items.push(...(await createInterpreterDetails()));

// Workspace Settings Items - assuming createWorkspaceSettingsItems returns an array of EnvironmentItem
items.push(...(await createWorkspaceSettingsItems()));

return items;
Expand Down
8 changes: 4 additions & 4 deletions src/views/activityBar/environmentView/viewHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ export async function createInterpreterDetails(): Promise<EnvironmentItem[]> {
const simplifiedPath = simplifyPath(resolvedEnv.path);

return [
new EnvironmentItem('Python Version', pythonVersion, TreeItemCollapsibleState.None),
new EnvironmentItem('Name', resolvedEnv?.environment?.name, TreeItemCollapsibleState.None),
new EnvironmentItem('EnvType', resolvedEnv?.environment?.type, TreeItemCollapsibleState.None),
new EnvironmentItem('Path', simplifiedPath, TreeItemCollapsibleState.None),
new EnvironmentItem('Python Version', pythonVersion, TreeItemCollapsibleState.None, '', 'interpreter'),
new EnvironmentItem('Name', resolvedEnv?.environment?.name, TreeItemCollapsibleState.None, '', 'interpreter'),
new EnvironmentItem('EnvType', resolvedEnv?.environment?.type, TreeItemCollapsibleState.None, '', 'interpreter'),
new EnvironmentItem('Path', simplifiedPath, TreeItemCollapsibleState.None, '', 'interpreter'),
];
}

Expand Down

0 comments on commit 615c91a

Please sign in to comment.