Skip to content
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

Comments being removed #4

Open
UsamaKarim opened this issue Sep 7, 2024 · 1 comment
Open

Comments being removed #4

UsamaKarim opened this issue Sep 7, 2024 · 1 comment

Comments

@UsamaKarim
Copy link

Before

{

    // Editor font related settings
    "editor.fontFamily": "JetBrains Mono",
    "editor.fontSize": 13,
    "editor.letterSpacing": 1.2,
    "editor.fontLigatures": true,
    // Causes the debug view to automatically appear when a breakpoint is hit. This
    // setting is global and not configurable per-language.
    "debug.openDebug": "openOnDebugBreak",
    // Dart Language related settings
    "[dart]": {
        // Automatically format code on save and during typing of certain characters
        // (like `;` and `}`).
        "editor.formatOnSave": true,
        "editor.formatOnType": true,
        // Draw a guide line at 80 characters, where Dart's formatting will wrap code.
        "editor.rulers": [
            80
        ],
        // Disables built-in highlighting of words that match your selection. Without
        // this, all instances of the selected text will be highlighted, interfering
        // with Dart's ability to highlight only exact references to the selected variable.
        "editor.selectionHighlight": false,
        // By default, VS Code prevents code completion from popping open when in
        // "snippet mode" (editing placeholders in inserted code). Setting this option
        // to `false` stops that and allows completion to open as normal, as if you
        // weren't in a snippet placeholder.
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        // By default, VS Code will pre-select the most recently used item from code
        // completion. This is usually not the most relevant item.
        //
        // "first" will always select top item
        // "recentlyUsedByPrefix" will filter the recently used items based on the
        //     text immediately preceding where completion was invoked.
        "editor.suggestSelection": "first",
        // Allows pressing <TAB> to complete snippets such as `for` even when the
        // completion list is not visible.
        "editor.tabCompletion": "onlySnippets",
        // By default, VS Code will populate code completion with words found in the
        // current file when a language service does not provide its own completions.
        // This results in code completion suggesting words when editing comments and
        // strings. This setting will prevent that.
        "editor.wordBasedSuggestions": "off",
    },
    "git.autofetch": true,
    "editor.inlineSuggest.enabled": true,
    "editor.bracketPairColorization.enabled": true,
    "editor.suggest.preview": true,
    "github.copilot.enable": {
        "*": true,
        "plaintext": true,
        "markdown": true,
        "scminput": false,
        "yaml": true
    },
    "stripe.telemetry.enabled": false,
    // "telemetry.enableTelemetry": false,
    // "telemetry.enableCrashReporter": false,
    "dotnetAcquisitionExtension.enableTelemetry": false,
    "footsteps.highlightColor": "rgb(211, 211, 211)",
    "footsteps.highlightColorMaxOpacity": 0.05,
    "thunder-client.codeSnippetLanguage": "cs-httpclient",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "dart.renameFilesWithClasses": "always",
    "[typescript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
    },
    "dart.debugExternalPackageLibraries": false,
    "dart.debugSdkLibraries": false,
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "redhat.telemetry.enabled": false,
    "workbench.iconTheme": "material-icon-theme",
    "i18nArbEditor.defaultLanguageFileName": "intl_en.arb",
    // JSON Langauge related settings
    "[json]": {
        "editor.defaultFormatter": "vscode.json-language-features"
    },
    "telemetry.telemetryLevel": "off",
    "window.commandCenter": true,
    "git.enableSmartCommit": true,
    "git.confirmSync": false,
    "diffEditor.ignoreTrimWhitespace": false,
    "dart.flutterSdkPath": "/Users/usama/Development/tooling/flutter",
    "workbench.colorTheme": "Tailwind Moon Gray",
    "settingsSync.ignoredExtensions": [],
    "gitlens.views.commitDetails.files.layout": "tree",
    "git.openRepositoryInParentFolders": "never",
    "errorLens.excludeBySource": [
        "dart(comment_references)"
    ],
    "codestream.serverUrl": "https://api.codestream.com",
    "cSpell.userWords": [
        "cupertino",
        "Karim",
        "Polyline",
        "Usama",
    ],
    "window.zoomLevel": 1,
    "terminal.integrated.env.osx": {
        "FIG_NEW_SESSION": "1"
    },
    // 5 June 2023
    "dart.experimentalRefactors": true,
    "dartImport.fixOnSave": true,
    "[markdown]": {
        "editor.wordWrap": "on"
    },
    "workbench.settings.applyToAllProfiles": [],
    "editor.accessibilitySupport": "off",
    "l10nization.appLocalizationsVariable": "context.l10n",
    // Using the light mode
    "indentRainbow.indicatorStyle": "light",
    // we use a simple 1 pixel wide line
    "indentRainbow.lightIndicatorStyleLineWidth": 2,
    // the same colors as above but more visible
    "indentRainbow.colors": [
        "rgba(255,255,64,0.3)",
        "rgba(127,255,127,0.3)",
        "rgba(255,127,255,0.3)",
        "rgba(79,236,236,0.3)"
    ],
    "github.copilot.advanced": {},
    "explorer.fileNesting.enabled": true,
    "explorer.fileNesting.patterns": {
        "*.dart": "${capture}.g.dart,${capture}.freezed.dart"
    },
    "github.copilot.editor.enableAutoCompletions": true,
    "editor.inlineSuggest.showToolbar": "always",
    "cloudcode.enableTelemetry": false,
    "cloudcode.project": "amigo-shuttle",
    "cloudcode.duetAI.project": "amigo-shuttle",
    "svg.preview.mode": "svg",
    "versionlens.suggestions.indicators": {
        "Directory": "📁 ",
        "Error": "🔴",
        "Latest": "🟢",
        "NoMatch": "",
        "Match": "🟡",
        "Updateable": ""
    },
    "gitlens.launchpad.indicator.enabled": false,
    "diffEditor.codeLens": true,
    "dart-data-class-generator.custom.headerLines": [],
    "dart-data-class-generator.useEquatable": true,
    "dart-data-class-generator.constructor.immutable": true,
    "dart-data-class-generator.constructor.required": true,
    "git.defaultCloneDirectory": "/Users/usama/Development/Projects",
}

After

{
  "window.commandCenter": true,
  "window.zoomLevel": 1,
  "workbench.iconTheme": "material-icon-theme",
  "workbench.colorTheme": "Tailwind Moon Gray",
  "workbench.settings.applyToAllProfiles": [],
  "explorer.fileNesting.enabled": true,
  "explorer.fileNesting.patterns": {
    "*.dart": "${capture}.g.dart,${capture}.freezed.dart"
  },
  "terminal.integrated.env.osx": {
    "FIG_NEW_SESSION": "1"
  },
  "editor.fontFamily": "JetBrains Mono",
  "editor.fontSize": 13,
  "editor.letterSpacing": 1.2,
  "editor.fontLigatures": true,
  "editor.inlineSuggest.enabled": true,
  "editor.bracketPairColorization.enabled": true,
  "editor.suggest.preview": true,
  "editor.suggestSelection": "first",
  "editor.accessibilitySupport": "off",
  "editor.inlineSuggest.showToolbar": "always",
  "git.autofetch": true,
  "github.copilot.enable": {
    "*": true,
    "markdown": true,
    "plaintext": true,
    "scminput": false,
    "yaml": true
  },
  "git.enableSmartCommit": true,
  "git.confirmSync": false,
  "gitlens.views.commitDetails.files.layout": "tree",
  "git.openRepositoryInParentFolders": "never",
  "github.copilot.advanced": {},
  "github.copilot.editor.enableAutoCompletions": true,
  "gitlens.launchpad.indicator.enabled": false,
  "git.defaultCloneDirectory": "/Users/usama/Development/Projects",
  "[dart]": {
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.rulers": [
      80
    ],
    "editor.selectionHighlight": false,
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.suggestSelection": "first",
    "editor.tabCompletion": "onlySnippets",
    "editor.wordBasedSuggestions": "off"
  },
  "[json]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "[markdown]": {
    "editor.wordWrap": "on"
  },
  "[typescript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "cSpell.userWords": [
    "cupertino",
    "Karim",
    "Polyline",
    "Usama"
  ],
  "cloudcode.duetAI.project": "amigo-shuttle",
  "cloudcode.enableTelemetry": false,
  "cloudcode.project": "amigo-shuttle",
  "codestream.serverUrl": "https://api.codestream.com",
  "dart-data-class-generator.constructor.immutable": true,
  "dart-data-class-generator.constructor.required": true,
  "dart-data-class-generator.custom.headerLines": [],
  "dart-data-class-generator.useEquatable": true,
  "dart.debugExternalPackageLibraries": false,
  "dart.debugSdkLibraries": false,
  "dart.experimentalRefactors": true,
  "dart.flutterSdkPath": "/Users/usama/Development/tooling/flutter",
  "dart.renameFilesWithClasses": "always",
  "dartImport.fixOnSave": true,
  "debug.openDebug": "openOnDebugBreak",
  "diffEditor.codeLens": true,
  "diffEditor.ignoreTrimWhitespace": false,
  "dotnetAcquisitionExtension.enableTelemetry": false,
  "errorLens.excludeBySource": [
    "dart(comment_references)"
  ],
  "files.exclude": {
    "**/.classpath": true,
    "**/.project": true,
    "**/.settings": true,
    "**/.factorypath": true
  },
  "footsteps.highlightColor": "rgb(211, 211, 211)",
  "footsteps.highlightColorMaxOpacity": 0.05,
  "i18nArbEditor.defaultLanguageFileName": "intl_en.arb",
  "indentRainbow.colors": [
    "rgba(255,255,64,0.3)",
    "rgba(127,255,127,0.3)",
    "rgba(255,127,255,0.3)",
    "rgba(79,236,236,0.3)"
  ],
  "indentRainbow.indicatorStyle": "light",
  "indentRainbow.lightIndicatorStyleLineWidth": 2,
  "l10nization.appLocalizationsVariable": "context.l10n",
  "redhat.telemetry.enabled": false,
  "settingsSync.ignoredExtensions": [],
  "stripe.telemetry.enabled": false,
  "svg.preview.mode": "svg",
  "telemetry.telemetryLevel": "off",
  "thunder-client.codeSnippetLanguage": "cs-httpclient",
  "versionlens.suggestions.indicators": {
    "Directory": "📁 ",
    "Error": "🔴",
    "Latest": "🟢",
    "NoMatch": "",
    "Match": "🟡",
    "Updateable": ""
  },
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue"
}
@HYP3R00T
Copy link
Owner

HYP3R00T commented Sep 7, 2024

Thanks for raising the issue. Currently, the extension doesn't recognise the position for single-line comments. If you have inline comments, it can keep that intact. But when we have single-line comments, there is some issue with keeping track of them.

If you can help me understand what is needed, we can find a universal solution.

Situations:

  • Descriptive comment: Consider a single-line descriptive comment that describes a certain setting which is followed immediately after a comment.
    // JSON Langauge related settings
    "[json]": {
        "editor.defaultFormatter": "vscode.json-language-features"
    },
  • Settings turned into comments: Sometimes we comment on a setting instead of removing the line so that we can enable it later.
// "telemetry.enableTelemetry": false,
  • Multiple single-line comments: When we group multiple comments together to ensure that it breaks a long statement into multiple single-line comments.
        // Disables built-in highlighting of words that match your selection. Without
        // this, all instances of the selected text will be highlighted, interfering
        // with Dart's ability to highlight only exact references to the selected variable.
        "editor.selectionHighlight": false,

Problem:

As this extension's only job is to sort the extensions based on certain custom orders (which I decided on and hard-coded), it was not initially designed to handle comments. Later in #2 we added the support for inline comments as it's easy to track them to individual key-value pairs.

For single-line comments, as described in the above situations, it's tricky to keep track of each comment. As the extension doesn't understand the content (because it's dumb), it can't know which comment is supposed to go where.

  • should I attach a comment to the immediate key-value pairs?
  • how to know if a comment is a description or if it was just a key-value pair comment for later usage?

Potential workaround:

Just keep the comment as an inline comment and keep the JSON clean. As too much comment will lead to clutter.

@HYP3R00T HYP3R00T mentioned this issue Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants