Skip to content

[Feat] Have option to use tabs instead of spaces (forced override) #238

Closed

Description

Is your feature request related to a problem? Please describe.
A problem is that the current core.format options do not support all IDE build environments. These 4 Java files will check for the preferences based on the type of project being worked on (defaulting to use spaces), but if you aren't using one of those project types, spaces will be used. These formatter options are used by the auto completions for code.

Describe the solution you'd like
Have a new checkbox on the completions preferences page to allow for an override to use tabs instead of spaces for indentation. When checked, this will override the format options that were determined/found and use tabs for auto completion code.

Describe alternatives you've considered
Have currently replaced the format options to use tabs instead of spaces by default. This means though manually updating the JAR file for each update. Alternatively it means trying to find/replace after finishing in a file 4 spaces for a tab character.

Additional context
The 4 format java files under com.microsoft.copilot.eclipse.core.format that use "space" instead of "tab" as default. Not sure if the code in these if fully functional (as in Java and workspace preferences, the tab policy is tabs only and "use spaces instead of tabs" is unchecked). Do to the way these formatter options are read, it ends up using spaces instead of tabs for new code blocks for auto-completions. For those that use tabs for indentation, not having an override option means a lot of fixing of code afterwards or mismatched indentation in files.

Activity

  1. jdneo commented on May 20, 2026

    @jdneo
    Member

    Hi Jordan M (@jomillerOpen)

    Could you provide repro steps for this issue?

  2. jomillerOpen commented on May 20, 2026

    @jomillerOpen
    ContributorAuthor

    Hi Sheng Chen (@jdneo)

    From my quick debugging, the entry point to determine the tab setting is in FormatOptionProvider.java's useSpace() function. This then calls getLanguageFormat(), which goes off to try to determine the language being worked with and get it's preference value. The only language formatters it supports is Java or C/C++. Anything else ends up getting down to the lines:
    if (languageFormatReaderForProject == null) {
    return new FormattingOptions(DEFAULT_TAB_SIZE, DEFAULT_USE_SPACE);
    }
    Where it will default to using spaces. I know the comment mentions using workspace preferences, but there isn't any code it seems that should read the generic editor tab options (Preferences>General>Editors>Text Editors: Insert spaces for tabs & Displayed tab width).

    If we wanted to use that setting as the backup (instead of having a new checkbox/preference to control it), we should really be trying to get those settings if the languageFormatReaderForProject is null and then gettting the "spacesForTabs" and "tabSize" preference values.

    I am using a workspace that is working with .os (Oscript) files, so that's why the formatter will end up defaulting to use spaces (and in which there's no other way of specifying tabs since the code has no other options to check for unknown languages).

  3. jdneo commented on May 21, 2026

    @jdneo
    Member

    Jordan M (@jomillerOpen) Thank you for the explanation. I get your point. Yes fallback to use generic editor tab options sounds better than always default to spaces.

  4. jomillerOpen commented on May 27, 2026

    @jomillerOpen
    ContributorAuthor

    Sheng Chen (@jdneo)
    Since I don't seem to be able to create branches on here, I can't do a pull request to submit a fix for it. Despite that, I managed to fix it locally on my own system. You're free to use those code changes for a new branch/pull request.

    Due to the way Eclipse handles it's preferences (and also not trying to include more plug in dependencies), it has to check multiple instances for the settings. This will successfully get the 2 settings mentioned, If it fails, will still fall back to the defaults the same as before.

    Just for clarification/awareness, these are the settings it will fall back to/try to retrieve if the project isn't a C or Java project;

    Image

    FormatOptionProvider.java

  5. jdneo commented on May 28, 2026

    @jdneo
    Member

    Jordan M (@jomillerOpen) You can fork the repo first, than work on your forked repo. After everything is done, you can make a pull request from your forked repo.

  6. jdneo commented on Jun 4, 2026

    @jdneo
    Member

    fixed by #267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions