Skip to content

Remove label from new routine stub #1612

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

Closed
Closed
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
19 changes: 6 additions & 13 deletions src/providers/FileSystemProvider/FileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
openLowCodeEditors,
compileErrorMsg,
} from "../../utils";
import { FILESYSTEM_READONLY_SCHEMA, FILESYSTEM_SCHEMA, intLangId, macLangId } from "../../extension";
import { FILESYSTEM_READONLY_SCHEMA, FILESYSTEM_SCHEMA } from "../../extension";
import { addIsfsFileToProject, modifyProject } from "../../commands/project";
import { DocumentContentProvider } from "../DocumentContentProvider";
import { Document, UserAction } from "../../api/atelier";
Expand Down Expand Up @@ -124,18 +124,11 @@ export function generateFileContent(
sourceLines.shift();
const routineName = fileName.split(".").slice(0, -1).join(".");
const routineType = fileExt != "mac" ? `[Type=${fileExt.toUpperCase()}]` : "";
if (sourceLines.length === 0 && fileExt !== "inc") {
const languageId = fileExt === "mac" ? macLangId : intLangId;

// Labels cannot contain dots
const firstLabel = routineName.replaceAll(".", "");

// Be smart about whether to use a Tab or a space between label and comment.
// Doing this will help autodetect to do the right thing.
const lineStart = vscode.workspace.getConfiguration("editor", { languageId, uri }).get("insertSpaces")
? " "
: "\t";
sourceLines.push(`${firstLabel}${lineStart};`);
if (!sourceLines.length) {
// Add a macro comment line
if (fileExt != "int") sourceLines.push("#;");
// Add a trailing newline
sourceLines.push("");
}
return {
content: [`ROUTINE ${routineName} ${routineType}`, ...sourceLines],
Expand Down