Title: fix: correctly handle user config by AbdElRahmanRMM · Pull Request #9 · JavaHello/java-deps.nvim · GitHub
Open Graph Title: fix: correctly handle user config by AbdElRahmanRMM · Pull Request #9 · JavaHello/java-deps.nvim
X Title: fix: correctly handle user config by AbdElRahmanRMM · Pull Request #9 · JavaHello/java-deps.nvim
Description: Currently, the setup() function in config.lua reassigns the entire module table M to a new table returned by vim.tbl_extend. As a result, any existing references to the original M (such as the one returned when requiring the module) becomes stale. This causes inconsistent behavior where: accessing keys from the table returned by require("java-deps.config") will result in the old values (ignoring any user supplied config). functions within the module (like config.get_split_command() or config.has_numbers()) uses the new values (the ones from the user config). That is because they are operating on different tables. a minimal example that showcases the issue: local function require_config() local M = { key = "original value" } M.setup = function (config) if config then M = vim.tbl_extend("force", M, config) end end M.get_key = function () return M.key end return M end local config = require_config() config.setup({ key = "new value"}) print(config.key) print(config.get_key()) This will output original value new value To fix this, I merged the new configuration directly into the existing M table. I also changed vim.tbl_extend to vim.tbl_deep_extend since the config has nested tables. There are other ways to fix this, but I think this approach minimize changes to the current codebase.
Open Graph Description: Currently, the setup() function in config.lua reassigns the entire module table M to a new table returned by vim.tbl_extend. As a result, any existing references to the original M (such as the one...
X Description: Currently, the setup() function in config.lua reassigns the entire module table M to a new table returned by vim.tbl_extend. As a result, any existing references to the original M (such as the one...
Opengraph URL: https://github.com/JavaHello/java-deps.nvim/pull/9
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:188abe1c-07e9-7e38-ca26-52ae138670e9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B206:331AE0:11638C4:17D676C:6A54523D |
| html-safe-nonce | 1027d78536a5eb80bc560b0c3ebe5899135be02214403257f6919846180ce64f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjA2OjMzMUFFMDoxMTYzOEM0OjE3RDY3NkM6NkE1NDUyM0QiLCJ2aXNpdG9yX2lkIjoiODUyOTU1ODk4NDM3MzU4ODU0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 10aa0eae1267b806fb885036a621cc931516114b64430789637cefa3b0aa3768 |
| hovercard-subject-tag | pull_request:2845190066 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/JavaHello/java-deps.nvim/pull/9/files |
| twitter:image | https://avatars.githubusercontent.com/u/150809978?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/150809978?s=400&v=4 |
| og:image:alt | Currently, the setup() function in config.lua reassigns the entire module table M to a new table returned by vim.tbl_extend. As a result, any existing references to the original M (such as the one... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/JavaHello/java-deps.nvim git https://github.com/JavaHello/java-deps.nvim.git |
| octolytics-dimension-user_id | 24937965 |
| octolytics-dimension-user_login | JavaHello |
| octolytics-dimension-repository_id | 585578921 |
| octolytics-dimension-repository_nwo | JavaHello/java-deps.nvim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 585578921 |
| octolytics-dimension-repository_network_root_nwo | JavaHello/java-deps.nvim |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width