aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/options.c
Commit message (Collapse)AuthorAge
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* refactor: fix includes for api/autocmd.hdundargoc2023-11-27
|
* build(IWYU): export generated headersdundargoc2023-11-27
|
* build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
|
* refactor: move Arena and ArenaMem to memory_defs.h (#26240)zeertzjq2023-11-27
|
* refactor: enable formatting for ternariesdundargoc2023-11-20
| | | | | | This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
* refactor: iwyu (#26062)zeertzjq2023-11-16
|
* build: remove PVSdundargoc2023-11-12
| | | | | | | We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
* refactor(options): `get_option_value_strict()` and `SREQ_*`Famiu Haque2023-10-20
| | | | `SREQ_*` values are now actual typedef'd enums. `get_option_value_strict()` has also been refactored and split into two functions, `get_option_attrs()` for getting the option attributes, and `get_option_value_strict()` for getting the actual value. Moreover, it now returns an `OptVal`. Other miscellaneous refactors have also been made.
* refactor(options): unify set_num_option and set_bool_optionFamiu Haque2023-10-17
|
* refactor: allow not having a `default` case for enumFamiu Haque2023-10-10
| | | | | | Problem: The style guide states that all switch statements that are not conditional on an enum must have a `default` case, but does not give any explicit guideline for switch statements that are conditional on enums. As a result, a `default` case is added in many enum switch statements, even when the switch statement is exhaustive. This is not ideal because it removes the ability to have compiler errors to easily detect unchanged switch statements when a new possible value for an enum is added. Solution: Add explicit guidelines for switch statements that are conditional on an enum, clarifying that a `default` case is not necessary if the switch statement is exhaustive. Also refactor pre-existing code with unnecessary `default` cases.
* build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|
* refactor: remove longdundargoc2023-09-29
| | | | | long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform.
* refactor(option): remove OPT_CLEARLewis Russell2023-08-31
|
* refactor(api): use typed keysetsbfredl2023-08-07
| | | | | Initially this is just for geting rid of boilerplate, but eventually the types could get exposed as metadata
* docs: miscJustin M. Keyes2023-08-03
| | | | Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
* fix(api/options): validate buf and winLewis Russell2023-07-22
| | | Fixes #24398
* refactor(api): adjust errors for setting options (#23942)zeertzjq2023-06-07
|
* refactor(options): remove `getoption_T` and introduce `OptVal` (#23850)Famiu Haque2023-06-07
| | | | | | | | Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options.
* refactor(api): new helper macrosFamiu Haque2023-05-23
| | | | Adds new API helper macros `CSTR_AS_OBJ()`, `STATIC_CSTR_AS_OBJ()`, and `STATIC_CSTR_TO_OBJ()`, which cleans up a lot of the current code. These macros will also be used extensively in the upcoming option refactor PRs because then API Objects will be used to get/set options. This PR also modifies pre-existing code to use old API helper macros like `CSTR_TO_OBJ()` to make them cleaner.
* refactor(options): deprecate nvim[_buf|_win]_[gs]et_optionLewis Russell2023-05-21
| | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
* refactor: uncrustifydundargoc2023-04-26
| | | | Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
* Merge pull request #22910 from bfredl/nonormalbfredl2023-04-06
|\ | | | | fix(highlight): use winhl=Foo:Bar even when Bar is empty
| * fix(highlight): use winhl=Foo:Bar even when Bar is emptybfredl2023-04-06
| | | | | | | | fixes #22906
* | refactor: make error message definitions constii142023-04-05
|/ | | | message.c functions now take const char * as a format. Error message definitions can be made const.
* fix(filetype): avoid recursive FileType autocmds (#22813)Lewis Russell2023-03-29
|
* fix(api): Use local LastSet structure in nvim_get_option_info (#22741)Michal Liszcz2023-03-29
| | | | | | | | | | fix(api): use local LastSet structure in nvim_get_option_info * nvim_get_option_info is deprecated. It is always using the global LastSet information as reported in #15232. * nvim_get_option_info2 is added. The new function additionally accepts an 'opts' table {scope, buf, win} allowing to specify the option scope and query local options from another buffer or window.
* fix(api): vim.filetype.get_option() (#22753)Lewis Russell2023-03-22
| | | | - Fix a bug in the cache - Set some buffer options on the dummy buffer
* refactor: do more in TRY_WRAPLewis Russell2023-03-22
|
* feat: add `vim.filetype.get_option()`Lewis Russell2023-03-20
|
* feat(api): add filetype option nvim_get_option_valueLewis Russell2023-03-20
| | | | | - Also adjust the expr-mapping behaviour so normal commands and text changes are allowed in internal dummy buffers.
* fix(api): set script context when setting usercmd or option (#22624)zeertzjq2023-03-11
|
* refactor(api): consistent VALIDATE messages #22262Justin M. Keyes2023-02-14
| | | | | | | | | | Problem: Validation messages are not consistently formatted. - Parameter names sometimes are NOT quoted. - Descriptive names (non-parameters) sometimes ARE quoted. Solution: Always quote the `name` value passed to a VALIDATE macro _unless_ the value has whitespace.
* refactor(api): VALIDATE macros #22256Justin M. Keyes2023-02-14
| | | | | | - VALIDATE() takes a format string - deduplicate check_string_array - VALIDATE_RANGE - validate UI args
* refactor(api): VALIDATE macros #22187Justin M. Keyes2023-02-14
| | | | | | | | | Problem: - API validation involves too much boilerplate. - API validation errors are not consistently worded. Solution: Introduce some macros. Currently these are clumsy, but they at least help with consistency and avoid some nesting.
* build: enable MSVC level 3 warnings (#21934)dundargoc2023-02-11
| | | | | | MSVC has 4 different warning levels: 1 (severe), 2 (significant), 3 (production quality) and 4 (informational). Enabling level 3 warnings mostly revealed conversion problems, similar to GCC/clang -Wconversion flag.
* vim-patch:8.1.2001: some source files are too big (#21231)zeertzjq2022-11-29
| | | | | | | Problem: Some source files are too big. Solution: Move buffer and window related functions to evalbuffer.c and evalwindow.c. (Yegappan Lakshmanan, closes vim/vim#4898) https://github.com/vim/vim/commit/261f346f8154c0ec7094a4a211c653c74e9f7c2e
* build: allow IWYU to fix includes for all .c filesdundargoc2022-11-15
| | | | | | | | | | Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
* feat(lua-api): avoid unnecessary allocations (#19877)Lewis Russell2022-11-14
| | | | Lua makes (or reuses) an internal copy of strings, so we can safely push buf pointers onto the stack.
* vim-patch:8.2.3751: cannot assign a lambda to an option that takes a functionzeertzjq2022-11-07
| | | | | | | | | | Problem: Cannot assign a lambda to an option that takes a function. Solution: Automatically convert the lambda to a string. (Yegappan Lakshmanan, closes vim/vim#9286) https://github.com/vim/vim/commit/6409553b6e3b4de4e1d72b8ee5445595214581ff Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* fix(docs): invalid :help links #20345Justin M. Keyes2022-09-25
| | | | | Fix those naughty single quotes. closes #20159
* docs: fix typos (#19024)dundargoc2022-07-31
| | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Valery Viktorovsky <viktorovsky@gmail.com>
* vim-patch:8.2.2254: Vim9: bool option type is numberzeertzjq2022-07-25
| | | | | | | Problem: Vim9: bool option type is number. Solution: Have get_option_value() return a different value for bool and number options. (closes vim/vim#7583) https://github.com/vim/vim/commit/dd1f426bd617ac6a775f2e7795ff0b159e3fa315
* fix(api): do not switch win/buf if getting option in current win/buf (#19383)zeertzjq2022-07-16
|
* Merge pull request #19041 from lewis6991/globallocalbfredl2022-06-25
|\ | | | | fix(api): nvim_set_option_value for global-local options
| * fix(api): nvim_set_option_value for global-local optionsLewis Russell2022-06-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | global-local window options need to be handled specially. When `win` is given but `scope` is not, then we want to set the local version of the option but not the global one, therefore we need to force `scope='local'`. Note this does not apply to window-local only options (e.g. 'number') Example: nvim_set_option_value('scrolloff', 10, {}) -- global-local window option; set global value nvim_set_option_value('scrolloff', 20, {win=0}) -- global-local window option; set local value nvim_set_option_value('number', true, {}) -- local window option is now equivalent to: nvim_set_option_value('scrolloff', 10, {}) nvim_set_option_value('scrolloff', 20, {win=0, scope='local'}) -- changed from before nvim_set_option_value('number', true, {win=0}) -- unchanged from before Only the global-local option with a `win` provided gets forced to local scope.
* | fix(api): check error after getting win/buf handle (#19052)Gregory Anders2022-06-22
|/
* refactor(option): DRY get/set option value #19038Lewis Russell2022-06-21
| | | | | | | | The main motivation for this is for the buf and win cases which need to set up and restore context, and it's what specifically makes the semantics of options nuanced, and thus this should not be repeated more than once. - nvim_get/set_option_value now share argument validation.
* feat(api): add "buf" and "win" to nvim_get_option_valueGregory Anders2022-06-20
| | | | These mirror their counterparts in nvim_set_option_value.
* refactor(api): move option code to own filebfredl2022-06-12