Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement outlineViewType setting that changes the Project Outline View (#3799)#4538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ar1m4n wants to merge1 commit intomicrosoft:main
base:main
Choose a base branch
Loading
fromar1m4n:dev/ar1m4n/AddOutlineViewTypeSetting
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsdocs/cmake-settings.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,6 +66,7 @@ Options that support substitution, in the table below, allow variable references
| `cmake.options.advanced` | Advanced options for CMake Tools. | See package.json | no |
| `cmake.options.statusBarVisibility` | Controls visibility of the status bar. | `hidden` | no |
| `cmake.outputLogEncoding` | Encoding to use for tool output. | `auto` | no |
| `cmake.outlineViewType` | Project Outline View`s type. | `["list", "tree"]` | no |
| `cmake.parallelJobs` | Specify the number of jobs run in parallel during the build. Using the value `0` will detect and use the number of CPUs. Using the value `1` will disable build parallelism. | `0` | no |
| `cmake.parseBuildDiagnostics` | If `true`, parse compiler output for diagnostics. | `true` | no |
| `cmake.pinnedCommands` | List of commands pinned to the command palette. | `["workbench.action.tasks.configureTaskRunner", "workbench.action.tasks.runTask"]` | no |
Expand Down
10 changes: 10 additions & 0 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2833,6 +2833,16 @@
],
"scope": "window"
},
"cmake.outlineViewType": {
"type": "string",
"enum": [
"list",
"tree"
],
"default": "list",
"description": "%cmake-tools.configuration.cmake.outlineViewType.description%",
"scope": "resource"
},
"cmake.options.advanced": {
"type": "object",
"default": {
Expand Down
1 change: 1 addition & 0 deletionspackage.nls.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -349,6 +349,7 @@
},
"cmake-tools.configuration.cmake.launchBehavior.newTerminal.markdownDescriptions": "A new terminal instance is created and the target is launched in it. Existing terminals are not automatically cleaned up.",
"cmake-tools.configuration.cmake.loadCompileCommands.description": "Controls whether the extension reads compile_commands.json to enable single file compilation.",
"cmake-tools.configuration.cmake.outlineViewType.description": "Project Outline View`s type. Available options are: \"list\" and \"tree\".",
"cmake-tools.command.cmake.projectStatus.update.title": "Refresh the project status",
"cmake-tools.command.cmake.pinnedCommands.add.title": "Add a CMake command to pin",
"cmake-tools.command.cmake.pinnedCommands.remove.title": "Unpin Command",
Expand Down
8 changes: 7 additions & 1 deletionsrc/config.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -223,6 +223,7 @@ export interface ExtensionConfigurationSettings {
postRunCoverageTarget: string | null;
coverageInfoFiles: string[];
useFolderPropertyInBuildTargetDropdown: boolean;
outlineViewType : string;
}

type EmittersOf<T> = {
Expand DownExpand Up@@ -601,6 +602,10 @@ export class ConfigurationReader implements vscode.Disposable {
return this.configData.useFolderPropertyInBuildTargetDropdown;
}

get outlineViewType(): string {
return this.configData.outlineViewType;
}

private readonly emitters: EmittersOf<ExtensionConfigurationSettings> = {
autoSelectActiveFolder: new vscode.EventEmitter<boolean>(),
defaultActiveFolder: new vscode.EventEmitter<string | null>(),
Expand DownExpand Up@@ -671,7 +676,8 @@ export class ConfigurationReader implements vscode.Disposable {
preRunCoverageTarget: new vscode.EventEmitter<string | null>(),
postRunCoverageTarget: new vscode.EventEmitter<string | null>(),
coverageInfoFiles: new vscode.EventEmitter<string[]>(),
useFolderPropertyInBuildTargetDropdown: new vscode.EventEmitter<boolean>()
useFolderPropertyInBuildTargetDropdown: new vscode.EventEmitter<boolean>(),
outlineViewType: new vscode.EventEmitter<string>()
};

/**
Expand Down
3 changes: 3 additions & 0 deletionssrc/extension.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,6 +275,9 @@ export class ExtensionManager implements vscode.Disposable {
this.workspaceConfig.onChange('mingwSearchDirs', async _ => { // Deprecated in 1.14, replaced by additionalCompilerSearchDirs, but kept for backwards compatibility
KitsController.additionalCompilerSearchDirs = await this.getAdditionalCompilerDirs();
});
this.workspaceConfig.onChange('outlineViewType', async _ => {
this.updateCodeModel(getActiveProject());
});
KitsController.additionalCompilerSearchDirs = await this.getAdditionalCompilerDirs();

let isMultiProject = false;
Expand Down
24 changes: 18 additions & 6 deletionssrc/ui/projectOutline/projectOutline.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@ import CMakeProject from '@cmt/cmakeProject';
import { populateViewCodeModel } from '@cmt/ui/projectOutline/targetsViewCodeModel';
import { fs } from '@cmt/pr';
import { CodeModelKind } from '@cmt/drivers/cmakeFileApi';
import { ConfigurationReader } from '@cmt/config';

nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
Expand DownExpand Up@@ -466,7 +467,8 @@ export class ProjectNode extends BaseNode {
constructor(
readonly name: string,
readonly folder: vscode.WorkspaceFolder,
readonly sourceDirectory: string
readonly sourceDirectory: string,
readonly config: ConfigurationReader
) {
// id: project_name:project_directory
super(`${name}:${sourceDirectory}`);
Expand DownExpand Up@@ -550,14 +552,24 @@ export class ProjectNode extends BaseNode {
if (target.isGeneratorProvided) {
continue;
}

if (target.folder) {
addToTree(tree, target.folder.name, target);

if(this.config.outlineViewType === "tree") {
const srcdir = target.sourceDirectory || '';
const relpath = path.relative(pr.sourceDirectory, srcdir);
addToTree(tree, relpath, target);
} else {
addToTree(tree, '', target);
if (target.folder) {
addToTree(tree, target.folder.name, target);
} else {
addToTree(tree, '', target);
}
}
}

if(this.config.outlineViewType === "tree") {
collapseTreeInplace(tree);
}

this._rootDir.update({
tree,
context: ctx,
Expand DownExpand Up@@ -639,7 +651,7 @@ export class WorkspaceFolderNode extends BaseNode {
const rootProject = projectOutlineModel.project;
let item = this.getNode(cmakeProject, rootProject.name);
if (!item) {
item = new ProjectNode(rootProject.name, this.wsFolder, cmakeProject.folderPath);
item = new ProjectNode(rootProject.name, this.wsFolder, cmakeProject.folderPath, cmakeProject.workspaceContext.config);
this.setNode(cmakeProject, rootProject.name, item);
}
item.update(rootProject, ctx);
Expand Down
3 changes: 2 additions & 1 deletiontest/unit-tests/config.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,7 +84,8 @@ function createConfig(conf: Partial<ExtensionConfigurationSettings>): Configurat
preRunCoverageTarget: null,
postRunCoverageTarget: null,
coverageInfoFiles: [],
useFolderPropertyInBuildTargetDropdown: true
useFolderPropertyInBuildTargetDropdown: true,
outlineViewType: "list"
});
ret.updatePartial(conf);
return ret;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp