question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue: Automatic DateTime Updates (lastmod) Requires Additional Extensions for MDX Files

See original GitHub issue

Describe the bug Despite “Auto-update modified date” being enabled in frontmatter.json, the lastmod field isn’t updated for MDX files unless an additional extension is installed, like MDX on the marketplace.

To Reproduce Steps to reproduce the behavior:

  1. Ensure the frontMatter.content.autoUpdateDate setting is set to true and no language support installed (or enabled) on VS Code.
  2. Use a block like this in your mdx file:
---
title: Sample Title
date: '2022-01-03T19:26:06.826Z'
lastmod: '2022-01-03T19:26:06.826Z'
---
  1. Update the content as you would in the editor.
  2. Observe that the lastmod property is not updated Note: The FrontMatter extension parses this block just fine, and if I explicitly click it to set the value, it does behave properly.

Expected behavior One extension probably shouldn’t depend on the presence of another to function, unless otherwise explicitly deemed necessary. I’d expect the plugin to update the lastmod value regardless of the language support being installed (this may be wrong of me to expect).

Screenshots N/A

VS Code Version

Version: 1.63.2 (Universal)
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:37:28.172Z (2 wks ago)
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin arm64 21.2.0

Extension Version v5.9.0

Additional context isMarkdownFile in ArticleHelper (seen here) expects the language to be identified. MDX isn’t supported out-of-the-box with VS Code-- meaning that for this method to work it requires installing another extension for this extension to support it.

I’m torn about whether or not this behavior makes sense-- I could understand arguments either way. If we wanted to support this without requiring the extension, we could check the file extension as one way to determine if it is a mdx file.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
farmeraucommented, Jan 5, 2022

@estruyf In further digging, there are two primary ways to handle this that I can see:

  1. We make the dependency on the MDX language extension explicit in the extension manifest, via extensionDependencies.
  2. We prefer not taking on the dependency and instead reference TextDocument.fileName as a fallback in isMarkdownFile when we check to see if the file belongs to one of the supported languages.

I admittedly don’t have a lot of practice with VS Code extensions, so I’m not sure what the best practice would be in this case.

My gut leans towards number 2, primarily because I anticipate MDX is the exceptional use-case and it doesn’t seem fair to ask users to install an extension that they might not be using in reality.

1reaction
estruyfcommented, Jan 5, 2022

@farmerau it is now available in the beta version

Read more comments on GitHub >

github_iconTop Results From Across the Web

[feat] IntelliSense support · Issue #165 · mdx-js/vscode-mdx
Ohh, VS Code 1.64 has IntelliSense for paths in Markdown files! I asked in the PR as to whether it could be enabled...
Read more >
Settings - Front Matter CMS
Settings. Overview. Most of Front Matter is configurable to your needs. In this part of the documentation all settings are explained.
Read more >
Need help in converting date time to date in Mdx query.
I want to convert or see the datetime column as only date value. The best bet is to convert it already on datasource...
Read more >
Task Factory Upsert Destination - SentryOne
The Upsert Destination is used to update and insert data into a SQL database table. Use Upsert Destination to insert new rows and...
Read more >
MDX - Visual Studio Marketplace
Extension for Visual Studio Code - Language support for MDX. ... will need to enable ESLint validation for .mdx and .md files like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found