38 Commits

Author SHA1 Message Date
Riccardo Ferretti
dcb951004a test:unit task now includes mock-friendly .spec.ts tests 2025-09-25 23:38:20 +02:00
Riccardo Ferretti
12a4fd98c3 removed deprecated jest extension setting 2025-07-25 10:22:55 +02:00
Riccardo
7a10c45ed8 Improved testing infrastructure (#1487)
* Added VS Code mock to turn e2e into unit/integration tests

* Provide fallback to editor directory when creating new note with relative path

* Added `clear` function to `FoamWorkspace`

* Fixed tests for dated notes by providing configuration defaults

* Using different workspace directory when resetting mock

* tweaked test suite configuration to manage vscode mock

* Tweaked test scripts to allow running specs in "unit" mode with mock vscode environment

* Marked spec files that can be run in unit mode

* Added testing documentation

* removed --stream flag 

* updated @types/node to match engine's version

* Fixing open-resource tests
2025-07-17 16:47:30 +02:00
Riccardo
6b02a87538 Web extension support for daily note (#1426)
* Using nodemon for watch task

* Added documentation and generator pattern to support getting some data from multiple sources

* asAbsoluteUrl can now take URI or string

* Tweaked daily note computation

* Replacing URI.withFragment with generic URI.with

* Removed URI.file from non-testing code

* fixed asAbsoluteUri

* Various tweaks and fixes

* Fixed create-note command
2025-02-21 13:07:00 +01:00
Riccardo Ferretti
540371bf96 Setting prettier as default formatter for typescript 2022-12-04 18:12:03 +01:00
memeplex
32c3a484d6 Improve linting (#887)
* Improve linting
2021-12-23 21:17:04 +01:00
Riccardo Ferretti
4fd573b9e4 Fixed VS Code settings file 2021-12-22 23:11:19 +01:00
memeplex
8abea48b5c Improve testing experience (#881)
* Improve testing experience
* Support vscode-jest for unit tests
2021-12-21 21:08:09 +01:00
Riccardo Ferretti
14f68aea30 minor fixes around VS Code test configurations and suite reporting 2021-10-25 19:22:00 +02:00
Riccardo
d222cfbbec Consolidate foam-core within foam-vscode (#774)
* moved `foam-core` inside `foam-vscode`

* updated contribution guide to reflect new modules setup

* improved testing

* consolidate to root yarn.lock files

* tweaking CI workflow && using github secrets to force cache refresh

* improved linting configuration. `core` module cannot depend on other parts of the `foam-vscode` package
2021-10-09 11:09:02 +02:00
Paul de Raaij
efac46174a Proposal and basic feature to include notes into a note (#741)
* Add the functionality to include notes in a note

* Add proposal of embedding

* Add tests for including notes

* Add documentation for inclusion feature
2021-09-13 17:23:40 +02:00
Riccardo Ferretti
78078cf338 improved foam settings 2021-05-06 10:04:00 +02:00
Riccardo
7412d518d7 Spike on FoamWorkspace and DataStore refactor (#593)
* extracted graph from workspace

* refactored datastore

* dataviz to use URI for placeholder detection

* graph uses uris, not resources

* adding placeholder in graph

* link completion to use graph

* API v1 - Resource refactoring (#595)

* aside: tweaked jest extension configuration

* added provider for markdown

* removed file check in URI

the problem is that it makes the URI dependent on the disk, which makes testing harder.
The change was originally introduced to prevent Foam from treating directories ending in .md as markdown files, but the check needs to probably happen somewhere else, e.g. in `FileDataStore.list` - or directories should be expressed with a trailing slash (to check whether that breaks the URI convention)

* Various changes

- `resolveLink` now delegates to providers
- added `read` method in providers and `FoamWorkspace`
- improved `Matcher` API
- updated tests to use workspace with providers
- delegating more to workspace now it can read files (simplifies wiring and exposed API surface)
- provider init returns a promise, so it can be awaited on
- `IDataStore` now has `list` method, to encapsulate all access to FS

* improved windows support in URI and matcher

* improved grouped resources interface

* added readAsMarkdown in provider, useful for tooltip generation with preview in vscode
2021-04-30 16:50:16 +02:00
Riccardo
fa4b9d57aa Wikilink navigation in markdown preview panel (#521)
* `FoamWorkspace.find` to return `null`  when no reference is provided for relative path

* turning wikilinks into browsable links in markdown preview

* moved preview styles in css file and reorganized code in static folder

Static was previous used only for the dataviz graph. Now we have 2 subdirectories: dataviz for the graph, and preview for the markdown preview.
For now the css style is a bit of an overkill, but sets up the right foundation for further customization down the line.

* chore: explicitly disabling gitdoc extension, removing unnecessary async keyword

* fix: fixed test utility fn (and linter warning)

* test: added tests for preview link generation

* changed launch configuration to support both foam-core and foam-vscode packages
2021-03-11 15:31:05 +01:00
Riccardo
026023dc7a Fix - Foam workspace update (live) (#497)
* improved delta logic in graph.js

fixes a bug that was due to using object.splice inside a forEach loop (sometimes stackoverflow is wrong - removing the element inside the loop will actually reduce the iterations and not all elements in the array will be visited!)

* various fixes to live update of workspace model + tests

* added tab size option in settings.json
2021-02-23 16:59:55 +01:00
Riccardo
cd92468311 Prettier format and chores (#448)
* fix #442 - link to known-issues replaced

* formatted settings + enable format on save + improved jest config

* removed editorconfig in foam-cli

* formatted foam-vscode

* removed author in package.json files

* minor changes to readme files

* fixed husky pre-commit hook
2021-01-14 17:00:03 +01:00
José Duarte
792e66b061 Add custom graph styling support (#438)
* Add graph style to VSCode settings

* Update default to an empty object

* Add function to retrieve the graph style from the settings

* Implement the graph custom styling setting

The implementation makes use of the webview communication mechanism to
switch messages between the webview and the graph.
It works as follows:

- When the webview is loaded, it now sends a single request to VSCode,
the request asks VSCode for the graph style
- When VSCode answers with the style, the graph style is updated and
the webview loading process continues as normal.

The style change does not modify the API, in fact it makes use of the
shadiest programming tatic ever, *global variables* to remain
compatible.

The style object *currently* supports four base fields:
- background: string
- fontSize: int
- highlightedForeground: string
- node: object
  - note: string
  - nonExistingNote: string
  - unknown: string

* Simplify null handling logic

* Remove debug logs

* Rename style setting

* Rename message style type

* Remove forgotten debug log

* Refactor the code to match model & action

* Add missing break

* Allow for dynamic style updates

* Fix the window loading bug

* Implement a permanent fix to the bug

* Replace `nonExistingNote` with `placeholder`

* Include the new graph style feature in the docs

* Remove unnecessary async

* Remove unused case
2021-01-13 17:55:58 +00:00
Riccardo
36a632f218 consolidated prettier configuration in root package.json file (#429)
also fixed linting and consolidated .gitignore and moved .editorconfig
2021-01-03 18:35:33 +01:00
José Duarte
a086a75e37 Add node_modules to the default Foam ignore list (#371)
* Add explicit foam ignores

* Add node_modules to the default ignores by Foam
2020-11-24 22:24:02 +01:00
Riccardo
87f172d217 Decoupled note ID from note slug (#208)
* decoupled ID from note slug

* added vscode debug configuration to work with vscode-jest extension

* made things prettier

* Add a test for parsing empty frontmatter

* Use astPositionToVsCodePosition util function

* fixed a TODOs around URIs and added tests

* added tests around notes querying

* removing unused imports

* Fix typo

* implemented PR feedback

* fixed lint warnings and renamed method for consistency

* removed unnecessary checks and fix compilation error in tests

Co-authored-by: Ankit Tiwari <ankitt255@gmail.com>
2020-08-05 18:37:35 +02:00
Jani Eväkallio
0e0355ae9f Fix VSCode Launch Task and Monorepo builds (#193)
* revise vscode task and launch configs

- Removed commands from sub-package:
  same can be achieved from the root
- Added build and no-build variants.
  In case separate watcher is already running,
  no need to build.
- Changed watch to build (no hot-reload in vscode by default)
- Show the build in console

Didn't update yarn.lock, seems to want to add
foam-core@0.3.0-alpha.0, but not really
related to this change

Note: the extension tests are failing due to
`Cannot find module '...foam-vscode/out/test/suite/index'`.
However that shouldn't be related to this change either.

* Simplify VS Code launch tasks (shift work to typescript compiler)

* Fix circular dependency index->janitor/index->index

* Use --build flag to use TSC in Build Mode
https://www.typescriptlang.org/docs/handbook/project-references.html#build-mode-for-typescript

This configures tsc to use multiple project roots (vscode, core) and run incremental builds on
changes to each projects. This will necessitate us running the core in commonjs build mode,
which is fine for testing and deployment to node environments, but won't work in the browser,
so foam-core will need a separate build config for UMD builds

* Build foam-core in commonjs mode by default (+cleanup unnecessary config)

* Create ES6 build config for distribution builds

* Cleanup yarn.lock

* Build package before running

* Fix missing lint paths and fix lint error

* Remove redundant .vscode settings files from foam-vscode project

* Add core test launch task

Co-authored-by: jojanaho <janne.ojanaho@iki.fi>
2020-07-30 21:39:16 +01:00
Riccardo Ferretti
639edafe52 extracted foam-core and created @foam modules 2020-07-12 02:38:05 +02:00
Janne Ojanaho
f2efd14186 Changed to unifiedjs-based markdown parsing (#78) 2020-07-11 07:59:05 +01:00
Jani Eväkallio
57811a8f30 Fix foam-vscode watcher task for monorepo running 2020-07-05 08:50:45 +01:00
Jani Eväkallio
3aa9664cfd Add foam-vscode launch commands and tasks to monorepo root, so the extension can be run from monorepo workspace 2020-07-05 08:03:23 +01:00
Jani Eväkallio
af0b89fe27 Move .vscode directory 2020-07-04 19:08:51 +01:00
Jani Eväkallio
62c58be870 Stub out and structure roadmap items 2020-07-04 12:56:37 +01:00
Jani Eväkallio
b6b9cf0254 Remove font ligatures from default settings 2020-07-03 17:22:32 +01:00
Jani Eväkallio
52024e6a60 Disable quick suggestions 2020-07-03 16:22:59 +01:00
Charlie
01b46a5d8d Use built-in git instead of Git Automator extension
This commit updates the git instructions
To use the built-in VS Code git integration instead of Git Automator.

- Automatically stage all changes
  "git.enableSmartCommit": true,

- Automatically push & pull changes to the remote after committing
  "git.postCommitCommand": "sync"

Updates the settings in this project to dogfood the new defaults.

This feature could be improved further
By setting a default key-binding to Git: Commit All,
And/or by automatically committing on save or focus change
For the most SaaS-like experience.

Part of issue #30 along with a PR to foambubble/foam-template.
2020-06-29 13:53:14 -07:00
Jani Eväkallio
892b7e3f42 Update graph visualisation docs (built into templates now) 2020-06-26 17:47:31 +01:00
Jani Eväkallio
cc106c4702 udpate documetation' 2020-06-25 00:44:44 +01:00
Jani Eväkallio
25404016cc Update documentation 2020-06-23 18:32:44 +01:00
Jani Eväkallio
65e9c44dc3 Brain dump 2020-06-21 21:36:41 +01:00
Jani Eväkallio
bdbc4e4ed9 Big brain dump 2020-06-20 23:15:34 +01:00
Jani Eväkallio
61081d9e38 Readme 2020-06-20 01:12:58 +01:00
Jani Eväkallio
9c00742504 Add recommended extensions 2020-06-20 01:04:35 +01:00
Jani Eväkallio
f5fdac707b Editor settings 2020-06-19 18:15:13 +01:00