Skip to content

Reduce firing of OpenedDocument action for projects #1319

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 0 additions & 7 deletions src/commands/unitTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { getFileText, methodOffsetToLine, outputChannel, stripClassMemberNameQuo
import { fileSpecFromURI } from "../utils/FileProviderUtil";
import { AtelierAPI } from "../api";
import { DocumentContentProvider } from "../providers/DocumentContentProvider";
import { StudioActions, OtherStudioAction } from "./studio";

enum TestStatus {
Failed = 0,
Expand Down Expand Up @@ -276,12 +275,6 @@ async function childrenForServerSideFolderItem(
const params = new URLSearchParams(item.uri.query);
const api = new AtelierAPI(item.uri);
if (params.has("project")) {
// Technically a project is a "document", so tell the server that we're opening it
await new StudioActions()
.fireProjectUserAction(api, params.get("project"), OtherStudioAction.OpenedDocument)
.catch(() => {
// Swallow error because showing it is more disruptive than using a potentially outdated project definition
});
query =
"SELECT DISTINCT CASE " +
"WHEN $LENGTH(SUBSTR(Name,?),'.') > 1 THEN $PIECE(SUBSTR(Name,?),'.') " +
Expand Down
12 changes: 0 additions & 12 deletions src/providers/FileSystemProvider/FileSearchProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { projectContentsFromUri, studioOpenDialogFromURI } from "../../utils/Fil
import { notNull } from "../../utils";
import { DocumentContentProvider } from "../DocumentContentProvider";
import { ProjectItem } from "../../commands/project";
import { StudioActions, OtherStudioAction } from "../../commands/studio";
import { AtelierAPI } from "../../api";

export class FileSearchProvider implements vscode.FileSearchProvider {
/**
Expand All @@ -23,16 +21,6 @@ export class FileSearchProvider implements vscode.FileSearchProvider {
const params = new URLSearchParams(options.folder.query);
const csp = params.has("csp") && ["", "1"].includes(params.get("csp"));
if (params.has("project") && params.get("project").length) {
// Technically a project is a "document", so tell the server that we're opening it
await new StudioActions()
.fireProjectUserAction(new AtelierAPI(options.folder), params.get("project"), OtherStudioAction.OpenedDocument)
.catch(() => {
// Swallow error because showing it is more disruptive than using a potentially outdated project definition
});
if (token.isCancellationRequested) {
return;
}

const patternRegex = new RegExp(`.*${pattern}.*`.replace(/\.|\//g, "[./]"), "i");
return projectContentsFromUri(options.folder, true).then((docs) =>
docs
Expand Down
13 changes: 0 additions & 13 deletions src/providers/FileSystemProvider/TextSearchProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { DocumentContentProvider } from "../DocumentContentProvider";
import { notNull, outputChannel, throttleRequests } from "../../utils";
import { config } from "../../extension";
import { fileSpecFromURI } from "../../utils/FileProviderUtil";
import { OtherStudioAction, StudioActions } from "../../commands/studio";

/**
* Convert an `attrline` in a description to a line number in document `content`.
Expand Down Expand Up @@ -396,18 +395,6 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
// Needed because the server matches the full line against the regex and ignores the case parameter when in regex mode
const pattern = query.isRegExp ? `${!query.isCaseSensitive ? "(?i)" : ""}.*${query.pattern}.*` : query.pattern;

if (params.has("project") && params.get("project").length) {
// Technically a project is a "document", so tell the server that we're opening it
await new StudioActions()
.fireProjectUserAction(api, params.get("project"), OtherStudioAction.OpenedDocument)
.catch(() => {
// Swallow error because showing it is more disruptive than using a potentially outdated project definition
});
}
if (token.isCancellationRequested) {
return;
}

if (api.config.apiVersion >= 6) {
// Build the request object
const project = params.has("project") && params.get("project").length ? params.get("project") : undefined;
Expand Down