20Tauri / DoxyDoxygen

The last word in code documentation generation
140 stars 5 forks source link

[Python] Respect the active view.settings.get("rulers") #142

Closed rwols closed 4 years ago

rwols commented 4 years ago

I have my ruler set at 120, because I've set my maximum col length to 120 in my pycodestyle linter settings. I would like this plugin to respect the (minimum) ruler when pressing ALT+Q. Right now, it re-formats my docs to a col length of 80.

20Tauri commented 4 years ago

The plugin don't use "pycodestyle" but please refer to the settings documentation.

Please read the preferred_line_length documentation. The best use probably to use Sublime Text rulers settings. The first element will be the one considered by DoxyDoxygen

It's strange because according the title, you use view.settings().get("rulers") and this works fine for me. Please give more details. At least versions used (Sublime, DoxyDoxygen), the rulers settings, an example. The integrated agent "Preferences -> Package Settings -> DoxyDoxygen -> Contact -> Anomaly Report" may help to generate a full report

rwols commented 4 years ago

My preferred_line_length is set to "auto".

From the ST console you can see that the ruler is set to 120:

>>> view.settings().get("rulers")
[120]

GIF:

Peek 2020-05-19 08-43

Sublime: build 4074 Doxygen: 0.76.2

DoxyDoxygen Report

Environment

- report.date:         2020-05-19 08:46:44.234281
- doxy.version:        0.76.2
- sublime.version:     4074
- sublime.platform:    linux
- sublime.arch:        x64
- package_control.version: 3.3.0
- package_control.installed: ['Alignment', 'AutomaticPackageReloader', 'AutomaticPackageReloader33', 'CMake', 'CMakeBuilder', 'Default', 'DoxyDoxygen', 'Ecmascript Syntax', 'GitSavvy', 'HexViewer', 'LSP', 'LSP-eslint', 'Package Control', 'Terminus', 'UnitTesting', 'UnitTesting33', 'Zig Language', 'fish', 'xml']
- python.version:      3.3.6
- python.compiler:     GCC 4.6.3
- python.implement:    CPython
- platform.os.name:    Linux
- platform.os.version: Linux-5.3.0-51-generic-x86_64-with-debian-buster-sid
- platform.cpu:        x86_64
- platform.arch:       x86_64
- platform.uname:      (system='Linux', node='raoul', release='5.3.0-51-generic', version='#44-Ubuntu SMP Wed Apr 22 21:09:44 UTC 2020', machine='x86_64', processor='x86_64')
- sys.recursionlimit:  1000

SublimeText Settings

- translate_tabs_to_spaces: True
- detect_indentation:  True
- indent_to_bracket:   False
- auto_indent:         True
- smart_indent:        True

DoxyDoxygen Settings

- autofill_reliability_percentage: 60,
- autofill_rules:        [],
- autofill_rules_default: <not sent>,
- block_layout:          {},
- block_layout_default:  {'SassDoc': ['', '@_brief', '', '@type', '', '@param', '', '@return', ''], 'Sphinx': ['', '@_brief', '', [':param', ':type'], '', ':returns:', ':rtype:', '', ':exception', ''], 'ApiDoc': ['', '@api', '@apiName', '@apiGroup', '', '@apiDescription', '', '@apiParam', '', '@apiSuccess', ''], 'DoxyDoc': ['', '@_brief', '', '@var', '@param', '@return', ''], 'XmlDoc': ['<summary>', '', '<paramref', '<param', '', '<returns>', '', '<exception'], 'JavaDoc': ['', '@_brief', '', '@param', '', '@return', '', '@throws', ''], 'AsDoc': ['', '@_brief', '', '@param', '', '@return', ''], 'GoogleClosure': ['', '@_brief', '', '@type', '', '@param', '', '@return', ''], 'Doxygen': [{'context': [{'key': 'row', 'operand': '0', 'operator': 'equal'}, {'key': 'kind', 'operand': '', 'operator': 'equal'}], 'tags': ['@defgroup         {file_base_name:doxy_upper();} {file_base_name:doxy_words();}', '', '@brief            This file implements {file_base_name:doxy_words();}.', '', '@author           {user_name:doxy_capitalize();}', '@date             {now:%Y}', '']}, {'context': [{'key': 'kind', 'operand': '^(?:var|constant)$', 'operator': 'regex_match'}, {'key': 'language', 'operand': '^(?:json)$', 'operator': 'regex_match'}], 'tags': ['@_brief']}, {'context': [{'key': 'kind', 'operand': '', 'operator': 'not_equal'}], 'tags': ['', '@brief', '', '@param', '', '@tparam', '', '@return', '']}], 'HeaderDoc': ['', '@_brief', '', '@var', '@const', '', '@param', '', '@return', ''], 'JsDoc': [{'context': [{'key': 'kind', 'operand': 'property', 'operator': 'equal'}], 'type': ['{return:doxy_type_to_description();doxy_The();}.'], 'tags': ['', '@_brief', '', '@type', '']}, {'context': [{'key': 'kind', 'operand': '', 'operator': 'not_equal'}], 'tags': ['', '@_brief', '', '@type', '@class', '@param', '@return', '']}], 'Drupal': ['', '@_brief', '', '@var', '@param', '', '@return', ''], 'Solidity': [{'context': [{'key': 'kind', 'operand': '^(?:class)$', 'operator': 'regex_match'}], 'tags': ['', '@title', '']}, {'tags': ['', '@dev', '@param', '@return', '']}], 'PhpDoc': [{'context': [{'key': 'row', 'operand': '2', 'operator': 'lower_than'}, {'key': 'kind', 'operand': '', 'operator': 'equal'}], 'tags': ['This file implements {file_base_name:doxy_words();}.', '', '@author           {user_name:doxy_capitalize();}', '@since            {now:%Y}', '']}, {'context': [{'key': 'kind', 'operand': '', 'operator': 'not_equal'}], 'tags': ['', '@_brief', '', '@var', '', '@param', '', '@throws', '', '@return', '']}], 'YuiDoc': ['', '@_brief', '', '@type', '@class', '@method', '@param', '@return', '']},
- brief_mode:            preserve,
- c_macros:              ['UCLASS()=', 'UFUNCTION()=', 'UPROPERTY(specifier, meta)=', 'UENUM(meta)=', 'KDE_EXPORT=', 'KDE_IMPORT=', 'KDE_NO_EXPORT=', 'KDE_BF_ENUM(a)=a', 'KDE_CAST_BF_ENUM(a, b)=b', 'KDE_CONSTRUCTOR_DEPRECATED=', 'K_GLOBAL_STATIC(TYPE, NAME)=', 'K_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)=', 'Q_INVOKABLE=', 'AFX_EXT_CLASS='],
- completion_enabled:    True,
- completion_snippet_format: default,
- completion_use_aliases: True,
- continuation_on_last_multilines_comment: False,
- continuation_on_singleline_comment: False,
- debug_enabled:         False,
- distance_for_bottom_line_over_top_line: 3,
- doc_styles:            {'JsDoc': []},
- doxygen_cmd:           doxygen,
- doxygen_command_prefix: @,
- doxygen_discard_param_directions: False,
- doxygen_paragraph_prefix:     ,
- group_tabs_sizes_by:   comment,
- indentation_max:       99999999,
- jsdoc_paragraph_prefix:   ,
- max_line_reducing:     12,
- merge_matching_ratio:  0.6,
- min_spaces_between_columns: [1, 2],
- notations_map:         [{'type': '~boolean~', 'regexp': '[$_]?(?:can|is|has|are)($|[A-Z_]).*$'}, {'type': 'Function', 'regexp': '(?:callback|cb|done|fn|method|next)$'}],
- php_generate_fully_qualified_name: True,
- phpdoc_paragraph_prefix:  ,
- phpdoc_short_primitives: False,
- preferred_comments_styles: [['/**', ' *'], [['/*', '-', '*//**'], ' *'], [['//', '-'], '///'], ['"""', '', '"""'], ['##', '##'], [['#', '-'], '##']],
- preferred_line_length: 80,
- preferred_tabs_sizes:  [12, 6, 8, 8, 8, 8],
- preserve_aliases:      False,
- profiles:              [],
- profiles_default:      <not sent>,
- proxies:               None,
- python_func_annotations_are_types: True,
- remove_template_used_as_type: False,
- source_languages:      [],
- target_language:       en,
- translators:           [{'api_key': '', 'provider': 'google'}],
- words_expansion:       {},

Edited text

- sublime.syntax:      Packages/Python/Python.sublime-syntax
- doxy.language:       python
Cursor 1

source.python comment.block.documentation.python

a aaaaaaaa aaaaaaaaa aaaaaaaaa.

    :param      current:  The current
    :type       current:  Any

CURSOR


    :param      dotted:   The dotted
    :type       dotted:   str

    :returns:   The dotted value.
    :rtype:     Any
    """
    keys = dotted.split('.')
    for key in keys:
        if isinstance(current, dict):
            current = current.get(key)
        else:
            return None
    return current

def set_dotted_value(current: dict, dotted: str, value: Any) -> None:
    keys = dotted.split('.')
    for i in range(0, len(keys) - 1):
        key = keys[i]
        next_current = c
20Tauri commented 4 years ago

preferred_line_length is evaluated to 80. You use auto mode and view.settings().get("rulers") returns [120] What is the result of sublime.load_settings("Preferences.sublime-settings").get("rulers", []) ? (should be [120] too). Can you confirm ? I haven't made test with 4074 and may explain the problem

rwols commented 4 years ago

The ruler setting is in my .sublime-project.

>>> import pprint; pprint.pprint(window.project_data()["settings"])
{'LSP': {'pyls': {'enabled': False,
                  'env': {'PYTHONPATH': '/opt/sublime_text/Lib/python33:/home/raoul/.config/sublime-text-3/Packages'}}},
 'ensure_newline_at_eof_on_save': True,
 'lsp.code_actions_on_save': True,
 'lsp.format_on_paste': True,
 'lsp_format_on_save': True,
 'rulers': [120],
 'tab_size': 4,
 'translate_tabs_to_spaces': True}

You should read view.settings(), it derives all that stuff automatically from Preferences.sublime-settings as well as overrides from .sublime-project files.

20Tauri commented 4 years ago

A change has been done in 0.66.1 for Sublime Text 2 compatibility (prior than 2174). But you are right ,view is the best way to get the settings.

Change will be made in the next release (probably released at the end of the week in the evolution channel)